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.