I would like to delete a specific SMS from Inbox in Android , How Can I query for a specific SMS ?
-
There is no "SMS inbox" in the Android OS. Some people think that the Messaging app from the Android open source project is always present, is always what the user is using, and use its undocumented and unsupported content provider. Google has expressly said not to do that. Apps that do that will break on various devices and may break on future versions of Android. You cannot delete an SMS from any "inbox in Android" reliably -- it is simply not a part of the OS or the SDK. – CommonsWare Apr 23 '11 at 11:47
2 Answers
You can just send or receive sms in a normal Android app which is not a default sms app but you cant delete it.All devices above 4.4 can have only one default sms app.You can ask user to make your app as a default sms app by placing a permission in manifest,After thisvall sms will be written to the sms provider using your app only but its completely on user whether he chooses your app for sending and receiving sms.If your app is a default sms app then you can delete the sms. The manifest for making your app a default sms app is here: ...
<!-- BroadcastReceiver that listens for incoming MMS messages -->
<receiver android:name=".MmsReceiver"
android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
<!-- Activity that allows the user to send new SMS/MMS messages -->
<activity android:name=".ComposeSmsActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
</activity>
<!-- Service that delivers messages from the phone "quick response" -->
<service android:name=".HeadlessSmsSendService"
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
</service>
</application>

- 399
- 1
- 2
- 12
To get access to Androids SMS-Inbox, you can use the "SMSManager". A tutorial on this can be found here.
Also, i found this older post. I'm not sure if this is the perfect way anymore, check if some of the used code is deprecated.

- 1
- 1

- 25,449
- 15
- 83
- 111
-
In this way you can send or receive SMS but the answer is not here. – Mustafa Genç Aug 26 '12 at 10:47