您的位置:首页 > 其它

发送数据消息

2009-10-22 22:38 337 查看
你可以使用SMS Manager的sendDataMessage方法来发送二进制数据。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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐