How Can i INTERCEPT an Incoming SMS With A specific Text
Look for Broadcast Receiver, this is dependent on the apps installed on the phone but you can give your app priority for listening to messages. Although, when a notification is shown, the message won't be in the SMS Database yet, so you will need to use abortBroadcast() to stop other apps being notified. See example below:
public class MessageReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Bundle pudsBundle = intent.getExtras();
Object[] pdus = (Object[]) pudsBundle.get("pdus");
SmsMessage messages =SmsMessage.createFromPdu((byte[]) pdus[0]);
Log.i(TAG, messages.getMessageBody());
if(messages.getMessageBody().contains("Hi")) {
abortBroadcast();
}
}
And you would need to declare the receiver in the manifest, like so:
<receiver android:name="com.encima.smsreceiver.MessageReceiver" android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
Finally, make sure you have the permission to RECEIVE_SMS in the manifest, hope that helps!
As of Android 4.4, what you ask to do in the question is impossible
Since Android version 4.4, If your app is not the default messaging app, you won't be able to perform those things promised in the accepted answer. You can neither stop the default messaging app from getting notified, nor you can delete an sms message.