解决方案 »

  1.   

    是不是方向就没有对呀,USB连接会不会压根儿就不用socket通过以太网的来通讯。
    菜鸟求指导。
      

  2.   

    很明显的事儿,usb又不是基于tcp/ip协议的可以通过adb控制发送广播,你的程序做个广播接收器来实现控制发送短信或者你干脆把手机连接到无线网,这就是usb没关系了
      

  3.   

    public class SmsBroadcastReceiver extends BroadcastReceiver 
        {      
              
             static final String ACTION = "action";            
              
             @Override  
             public void onReceive(Context context, Intent intent) 
             {  
                    if (intent.getAction().equals(ACTION))
                   {  
                 Toast.makeText(MainActivity.this, intent.get,Toast.LENGTH_LONG ).show();
                    }  
             }  
        }adb shell am broadcast -a test --es test_string "this is test string"
    用这条命令来发送消息,上面的onReceive收不到。adb shell am broadcast -a test
    这样就能收到,但就只有action,没法带入消息的内容唉
      

  4.   

    if (intent.getAction().equals(ACTION))
    {
             Bundle bun = intent.getExtras();
             String Msg1 = bun.getString("key");
                
    }