(Tested with Android 2.3.3 SDK)
Sometimes, you need to simulate an incoming short message for
your app. For instance, an encryption app could need to intercept
incoming SMS using a BroadcastReceiver, then check if the SMS was
encrypted and if so, decrypt it. Then the decrypted SMS and not
the original one should be processed further (show up in SMS app
etc.).
The usual way is to create a BroadcastReceiver, intercept the
SMS_RECEIVED broadcast on the incoming message and abort the
broadcast if necessary (if the message was encrypted or somehow
else only for your app). Then you could generate a notifcation
and put the SMS into the inbox:
Putting an SMS directy into the native inbox database
You will need the WRITE_SMS privilege.
public static final String SMS_EXTRA_NAME = "pdus";
public static final String SMS_URI = "content://sms";
public static final String ADDRESS = "address";
public static final …
[Read more]