I'm building an app to remove SMS in Android. From Android kitkat or above, I understand I need to make my app as default SMS app from several sources like
How to delete particular inbox message in android version 5.0 lolipop or in Kitkat?
I also tried the solution from http://pulse7.net/android/android-delete-sms-message-from-inbox-in-android/ and it worked perfect so I could remove messages one by one.
However, I'm trying to embed this solution in custom library and the following code in custom confirmation dialog does not work.
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getPackageName());
startActivity(intent);
To make it work in library, I passed the context
variable to the library and updated the code as follows.
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName());
context.startActivity(intent);
Can anyone help me?