I have the normal 'Phone' dialer and I have new 'Dialer' app. Now if I check the "Use by default for this action" and click on the 'Dialer' app then every time when I press the phone button the 'Dialer' app will be started automatically. But how can I change this in code ?
Where this preference is stored ?
And how is this mapped ? is this is mapped by an android action intent string ?
for example the Intent.ACTION_CALL is paired with some application for example the 'Dialer' app to be the default app that will be started every time the Intent.ACTION_CALL it is raised...
Thanks
Starting from API 21 you can use next intent to ask user to be a default dialer:
Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER)
.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getPackageName());
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, REQUEST_CODE_SET_DEFAULT_DIALER);
} else {
Log.w(getLocalClassName(), "No Intent available to handle action");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With