0

Refering to This Answer. I wrote this code in menifest and that worked fine for me... But I want to set my app as default on click Event for All android version including kitkat. Can someone help me to do so??

as it is done in kitkat through intent like this:

if (! Telephony.Sms.getDefaultSmsPackage(this).equals(myPackageName) ) {

            // App is not default.
            // Show the "not currently set as the default SMS app" interface

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("Yelo is not your default messaging app. Do you want to set it default?")
            .setCancelable(false)
            .setTitle("Alert!")
            .setNegativeButton("No", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            })
            .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    Intent intent =new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
                    intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME,getPackageName());
                    startActivity(intent);
                }
            });
            builder.show();
        }

just like this... I want to do it for all android versions.

Community
  • 1
  • 1
andi devol
  • 53
  • 5
  • 1
    The concept of a default SMS app started with KitKat, so there's no such thing for previous versions. – Mike M. Aug 05 '14 at 09:36
  • but it is done in "Hello" sms app. if we click for hello to be default sms app, it is set to default otherwise not even if your android version is less than kitkat. – andi devol Aug 05 '14 at 09:48
  • I have already set the priority of receiver to max in menifest, and thats working fine... but i don't know how to set priority to my receiver dynamically in Java Class instead of menifest. – andi devol Aug 07 '14 at 06:02

0 Answers0