arekolek / simple-phone

Bare minimum implementation of an Android Phone app
MIT License
198 stars 71 forks source link

how to clear setting and reset back to system dialer app #4

Closed shmehdi01 closed 5 years ago

shmehdi01 commented 5 years ago

I want reset my app setting and go back to system dialer app? How it is possible?

arekolek commented 5 years ago

One option is to delete the phone app you don't want, the system will revert to default one.

Another is to find the "Default apps" settings in your phone system settings, which exact location vary depending on the manufacturer.

Like mentioned in the README, in stock Android that's: Settings -> Apps & notifications -> Advanced -> Default apps -> Phone app:

shmehdi01 commented 5 years ago

I know but i want to reset programmatically, if i uninstall the app when ever i reinstall it automatically detect if previously used as default dialer.

arekolek commented 5 years ago

The best you can do is to use an intent with ACTION_MANAGE_DEFAULT_APPS_SETTINGS

Maybe, you could also find out what the system dialer is by doing what Android does and then pass that package name instead of yours to the

Intent(ACTION_CHANGE_DEFAULT_DIALER)
    .putExtra(EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, packageName)

and I wouldn't expect anything more automated than that, because it would be weird if an app could change the dialer without asking the user about it.