Joterito
Joterito

Reputation: 151

Unset default home screen from code

I'm trying to unset the default home screen programatically. My app is defined as home in manifest but if the user select the phone home screen as default (in the dialog to select the home screen) i cannot set my app as home again.

If the user select my app as home screen as default (with the checkbox "set as default") i have only to do:

clearPackagePreferredActivities("MypackageApp"); //from packagemanager

Then the selector appears again. But I don't know how to do for the dialog to select the current home screen appears again (when the user select the phone home screen as default) . I have tryed this:

clearPackagePreferredActivities("com.android.launcher"); //from packagemanager But i obtain an error: java.lang.security.exception Neither user * nor current process has android.permission.SET_PREFERRED_APPLICATIONS. But i have defined this permission in my manifest app.

Upvotes: 1

Views: 1188

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

I'm trying to unset the default home screen programatically.

Fortunately, this is not possible, for obvious security reasons.

My app is defined as home in manifest but if the user select the phone home screen as default (in the dialog to select the home screen) i cannot set my app as home again.

The user who switched back to a different home screen would consider this to be a very good thing.

But i have defined this permission in my manifest app.

You can only hold that permission if your application is signed by the same signing key as was used to sign the firmware.

Upvotes: 2

Related Questions