/**
* Parse the messages out of the extra fields from the "android.permission.RECEIVE_SMS" broadcast
* intent.
*
* Note: This code was copied from the Android android.provider.Telephony.Sms.Intents class.
*
* @param intent the intent to read from
* @return an array of SmsMessages for the PDUs
*/
public static SmsMessage[] getMessagesFromIntent(
Intent intent) {
Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
byte[][] pduObjs = new byte[messages.length][];
for (int i = 0; i < messages.length; i++) {
pduObjs[i] = (byte[]) messages[i];
}
byte[][] pdus = new byte[pduObjs.length][];
int pduCount = pdus.length;
SmsMessage[] msgs = new SmsMessage[pduCount];
for (int i = 0; i < pduCount; i++) {
pdus[i] = pduObjs[i];
msgs[i] = SmsMessage.createFromPdu(pdus[i]);
}
return msgs;
}
Textingsvc.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:alternate-java-bridge-library
作者:
评论列表
文章目录