Clear laucher defaults programmatically

两盒软妹~` 提交于 2019-12-02 21:40:58

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/10246193/clear-laucher-defaults-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!