发送数据消息

你可以使用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);

posted on 2009-10-22 22:38  xirihanlin  阅读(861)  评论(0编辑  收藏  举报