开发者

Accessing the inbox in android application

I am developing an android message based ap开发者_如何学Goplication in which i have to access inbox programatically.Can anyone tell how should i pursue


There is no documented and supported API in the Android SDK for accessing any sort of "inbox".


You should implement broadcast rceiver on "android.provider.Telephony.SMS_RECEIVED" Action.

After that read message data from intent:

Object[] pduArray = (Object[]) intent.getExtras().get("pdus"); 

SmsMessage[] messages = new SmsMessage[pduArray.length]; 

StringBuilder messageText = new StringBuilder();

for (int i = 0; i < pduArray.length; i++) {                 
     messages[i] = SmsMessage.createFromPdu((byte[])pduArray [i]);              
     messageText.append(messages[i].getMessageBody());          
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜