Tushar
Tushar

Reputation: 5935

Accessing the inbox in android application

I am developing an android message based application in which i have to access inbox programatically.Can anyone tell how should i pursue

Upvotes: 1

Views: 653

Answers (2)

CommonsWare
CommonsWare

Reputation: 1007276

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

Upvotes: 1

Maxim
Maxim

Reputation: 3006

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());          
} 

Upvotes: 0

Related Questions