I want to override the default messaging app for Android. If I receive sms or mms, I want to send it by e-mail, but I do not want to receive notifications by phone. So basically I want to replace the default messaging application.
How can I make my application default to those who accept sms?
Many thanks. This is exactly what I need. But I have one more problem. I used the receiver to receive the message ... but I don’t know how to find the message on the phone and mark it as read.
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
if (bundle != null)
{
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
str += "SMS from " + msgs[i].getOriginatingAddress();
str += " :";
str += msgs[i].getMessageBody().toString();
str += "\n";
}
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
Uri uriSms = Uri.parse("content://sms/inbox/");
try{
Cursor c = context.getContentResolver().query(uriSms, null,null,null,null);
...
}
Is there a way to identify a message as an identifier? Now I find a message comparing the bofy and sender numbers for all messages in the inbox.
Thanks Radu