简体   繁体   中英

How to make android app as the default launcher on a tablet

I am working on a kiosk mode application,wherein I want my app to work as the default launcher,instead of the android launcher.On device reboot my app should pop up as the default launcher.For the same,I have created an app to act as a launcher for a kiosk mode application running on an android tablet namely iBall 3G7171 HD7(4.2.2).In the manifest I have given the relevant permissions as follows.

<activity
    android:name="com.abc.Main"
    android:label="@string/app_name"
    android:launchMode="singleTop"
    android:screenOrientation="landscape">

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <!-- The following two intent-filters are the key to set homescreen -->
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />                 
    </intent-filter>

</activity>

While I run this code on my samsung s2, on reboot this app is launched as the launcher app and works as expected. I see that the app is not launched as the launcher app on device reboot,instead its the default android launcher that pops up. 该应用程序时,我看到该应用程序未在设备重新启动时作为启动器应用程序启动,而是弹出了默认的Android启动器。

I listened to the BOOT COMPLETE intent to launch my launcher app.But the problem here is that the BOOT COMPLETE intent is fired after about 5 seconds,during which the default android launcher shows up,post which my launcher app is called.I do not want it to work this way,hence the approach of listening to boot complete broadcast won't work for my case. 我听了启动我的启动器应用程序的BOOT COMPLETE意图,但是这里的问题是BOOT COMPLETE意图在大约5秒钟后被触发,在此期间默认的Android启动器出现了,发布了我的启动器应用程序我不希望它如此工作,因此听开机启动广播的方法不适用于我的情况。

: Is to launch my launcher app immediately when my device reboots. 是:设备重启后立即启动启动器应用程序。 What is it that I am missing/doing wrong in my current code.Any help would be appreciated.Many thanks !

If you are ok using adb shell command, then

  1. Install your current app in device.
  2. Connect to pc/mac enable usb debugging. Find the package name of your default launcher using this command. " adb shell pm list packages "
  3. Disable the default launcher " adb shell pm hide com.android.yourlauncher "

done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM