android - Intercept Incoming SMS Message and Modify it -
is there way intercept incoming sms message, , modify before presenting user?
- can done natively on iphone / andriod?
- can done using phonegap?
- can done using monotouch / mono andriod?
if yes of above, please provide pointers it?
my preferred-solution priority-order follows:
- phonegap
- mono
- native
thank in advance!!
edit:
for people wondering purpose of this, put word "label" in sms depending on content, when view sms, can see "important: blah blah blah", instead of "blah blah blah".
try out this- //register class receiver in manifest file sms_received intent
public class smsreceiver extends broadcastreceiver { private static final string sms_received = "android.provider.telephony.sms_received"; @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(sms_received)) { abortbroadcast();**this prevent message deliver user** bundle bundle = intent.getextras(); if (bundle != null) { // sms objects object[] pdus = (object[]) bundle.get("pdus"); if (pdus.length == 0) { return; } // large message might broken many smsmessage[] messages = new smsmessage[pdus.length]; stringbuilder sb = new stringbuilder(); (int = 0; < pdus.length; i++) { messages[i] = smsmessage.createfrompdu((byte[]) pdus[i]); sb.append(messages[i].getmessagebody()); } string sender = messages[0].getoriginatingaddress(); string message = sb.tostring(); toast.maketext(context, message, toast.length_short).show(); smsmanager sms = smsmanager.getdefault(); sms.sendtextmessage(phonenumber, null, message, null, null);//phone number number. } } } }
Comments
Post a Comment