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());
}
精彩评论