且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置我的应用程序默认情况下,植根设备

更新时间:2022-11-03 15:35:48

  

有没有办法做到这一点有根的设备上?

最简单的办法是从注释拒绝一:删除股票发​​射器,使你是唯一的启动

  

这是一种基于ICS的设备所以加preferredActivity似乎不工作,我不能让即使该设备是植根于android.permission.SET_ preFERRED_APPLICATIONS权限。

根,其本身无关,与权限。在这种情况下, SET_ preFERRED_APPLICATIONS 是签名级别的权限,这意味着您的应用程序必须由同一个签名密钥的固件签署,这将不除非你滚你自己改装成光盘成为可能。

如果我读the Android源$ C ​​$ C 正确,的结果添加preferredActivity()风在 /数据/系统/包的.xml ,在< preferred-活动> 元素。玩弄修改该文件的非常仔细地,然后看看是否你想要什么就会得到你。

We have a tablet app that we're deploying at retail outlets. It currently self updates late at night but after it does it is no longer the default "home" application and the user is given the choice to start our app or the default launcher again. We'd like to always have our app be the default home application even after updates. Is there a way to do this on a rooted device?

This is an ICS based device so the addPreferredActivity doesn't seem to work as I cannot get the android.permission.SET_PREFERRED_APPLICATIONS permission even though the device is rooted. If there is a way around that, I think I could get this done..

Is there a way to do this on a rooted device?

The simplest solution is the one you rejected from the comment: remove the stock launcher and make yours be the only launcher.

This is an ICS based device so the addPreferredActivity doesn't seem to work as I cannot get the android.permission.SET_PREFERRED_APPLICATIONS permission even though the device is rooted.

Root, by itself, has nothing to do with permissions. In this case, SET_PREFERRED_APPLICATIONS is a signature-level permission, meaning that your app would have to be signed by the same signing key as the firmware, which will not be possible unless you roll your own modded ROM.

If I am reading the Android source code correctly, the results of addPreferredActivity() wind up in /data/system/packages.xml, in a <preferred-activities> element. Play around with modifying that file very carefully and see if that will get you what you want.