将自己做的APP做成Android的launcher,开机后不再进入系统的桌面UI,而是直接进入APP。
首先是AndroidManifest.xml
里面: <application>
里面添加这两个属性:
-
android:largeHeap=
"true"
-
android:persistent=
"true"
- 1
- 2
- 1
- 2
在启动的activity里面添加filter
-
<intent-filter>
-
<action android:name="android.intent.action.MAIN" />
-
<category android:name="android.intent.category.DEFAULT" />
-
<category android:name="android.intent.category.HOME" />
-
</intent-filter>
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
然后,在手机设置-主屏幕里面,选择你要使用的launcher,即选择你的APP。
注:有些手机,比如小米手机,其系统厂家做过修改,关闭了修改launcher的接口,所以无法修改launcher。重新刷机应该可以修改。
android:persistent=”true” 属性的理解:
字面意思来理解是可持久的,也即是常驻的应用。其实就是这么个理解,被android:persistent=true修饰的应用会在系统启动之后被AM启动。(好像还有设置进程优先级的作用)。
参考文章:http://blog.csdn.net/windskier/article/details/6560925