Is there a way to intercept an incoming SMS message, and then modify it before presenting it to the user?
If yes to any of the above, could you please provide some pointers to it?
My preferred-solution priority-order is as follows:
Thank you all in advance!!
EDIT:
For people wondering what is the purpose of this, basically I would like to put a word as a "label" in the sms depending on the content, so when I view the sms, I can see something like "IMPORTANT: blah blah blah", instead of just "blah blah blah".
try out this- //register this class as receiver in manifest file for 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 is prevent message to deliver to user**
Bundle bundle = intent.getExtras();
if (bundle != null) {
// get sms objects
Object[] pdus = (Object[]) bundle.get("pdus");
if (pdus.length == 0) {
return;
}
// large message might be broken into many
SmsMessage[] messages = new SmsMessage[pdus.length];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 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 will be your number.
}
}
}
}
Sure! The EASIEST way on iOS is just to create a trigger on the SMS database - /var/mobile/Library/SMS/sms.db
CREATE TRIGGER AFTER INSERT ON message
then update the record!
The more advanced way of doing it, is hooking private methods, but I won't go that deep right now, you just need to explore the methods :)
BTW, you in any way you NEED a jailbroken device
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With