下载此文档

PC客户端与Android服务端的Socket同步通信.docx


文档分类:IT计算机 | 页数:约38页 举报非法文档有奖
1/38
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/38 下载此文档
文档列表 文档介绍
PC客户端与Android办事端的Socket同步通信(USB) 收藏
需求:
,作为socket的办事器端;用于吸收Pc client端发来的命令,来处置惩罚数据后,把结果发给PC client
,作为socket的客户端,用于给android手机端发操纵命令
难点阐发:
,即插上USB线时马上提示的对话框选adb。很多多少敌手机的操纵都可以用adb直接作。
不外,我发明LG GW880就没有,要去下载个
“”
,一定要用adb forward 来作下端口转发才气连上socket.
view plaincopy to clipboardprint?
().exec("adb forward tcp:12580 tcp:10086");
(3000);
().exec("adb forward tcp:12580 tcp:10086");
(3000);
,但是还要有要领来从PC的client端来启动手机上的service ,这个措施可以通过PC端adb命令来发一个Broastcast ,手机端再写个吸收BroastcastReceive来吸收这个Broastcast,在这个BroastcastReceive来启动service

pc端命令:
view plaincopy to clipboardprint?
().exec(
"adb shell am broadcast -a NotifyServiceStart");
().exec(
"adb shell am broadcast -a NotifyServiceStart");
view plaincopy to clipboardprint?
package ;

import ;
import ;
import ;
import ;

public class ServiceBroadcastReceiver extends BroadcastReceiver {
private static String START_ACTION = "NotifyServiceStart";
private static String STOP_ACTION = "NotifyServiceStop";

***@Override
public void onReceive(Context context, Intent intent) {
(, ().getName() + "---->"
+ "ServiceBroadcastReceiver onReceive");

String action = ();
if ((action)) {
(new Intent(context, ));

(, ().getName() + "---->"
+ "Servi

PC客户端与Android服务端的Socket同步通信 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数38
  • 收藏数0 收藏
  • 顶次数0
  • 上传人892629196
  • 文件大小19 KB
  • 时间2021-07-24