发送数据消息

mac2022-06-30  54

你可以使用SMS ManagersendDataMessage方法来发送二进制数据。sendDataMessage方法很像sendTextMessage,但包含额外的参数——目标端口和你要发送数据的字节数组。

 

接下来的框架代码显示了发送一个数据消息的基本结构:

 

Intent sentIntent = new Intent(SENT_SMS_ACTION);

PendingIntent sentPI = PendingIntent.getBroadcast(getApplicationContext(),0,sentIntent,0);

short destinationPort = 80;

byte[] data = [ … your data … ];

smsManager.sendDataMessage(sendTo, null, destinationPort, data, sentPI, null);

转载于:https://www.cnblogs.com/xirihanlin/archive/2009/10/22/1588355.html

最新回复(0)