Search code examples
androidpermissionsdefaultlauncher

Clear laucher defaults programmatically


I am trying to delete default laucher parameters (to let user choose another app) with android.permission.SET_PREFERRED_APPLICATIONS. I googled that this is not possible, but there is a kidzone app (http://www.kidzoneapp.com/ see youtube video) that uses this technology.

I am trying now to clear defaults with

pm.clearPackagePreferredActivities("com.fede.launcher");

but getting this error:

04-20 16:05:50.272: E/AndroidRuntime(6926): Caused by: java.lang.SecurityException: Neither user 10070 nor current process has android.permission.SET_PREFERRED_APPLICATIONS.2

ok, if I am unable to clear launcher defaults, how can I detect which laucher is default now, and open Applications->Manage applications->Launcher name dialog? (http://hothardware.com/articleimages/Item1525/small_move-to-sd-card-froyo.png) And there user will be able to clear defaults himself


Solution

  • I am trying to delete default laucher parameters (to let user choose another app)

    That is no longer possible.

    there is a kidzone app (http://www.kidzoneapp.com/ see youtube video) that uses this technology.

    It does on older versions of Android, where this was allowed.

    Moreover it does it with the same permission in manifest.

    Nowadays, that permission is no longer used, and it can only be held by applications signed by the same signing key as was used to sign the firmware.