简体   繁体   English

如何使Android应用成为平板电脑上的默认启动器

[英]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. 我正在使用信息亭模式的应用程序,其中我希望我的应用程序可以用作默认启动器,而不是android启动器。在设备重启时,我的应用程序应该弹出作为默认启动器。同样,我创建了一个应用程序来充当在Android平板电脑(即iBall 3G7171 HD7(4.2.2))上运行的信息亭模式应用程序的启动器。在清单中,我已授予以下相关权限。

<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. 当我在三星s2上运行此代码时,在重新启动时,此应用程序将作为启动器应用程序启动,并按预期运行。 However,when I run it on my tablet 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启动器。

What I tried : 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启动器出现了,发布了我的启动器应用程序我不希望它如此工作,因此听开机启动广播的方法不适用于我的情况。

What I want : 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 如果使用adb shell命令没问题,那么

  1. Install your current app in device. 在设备中安装当前应用。
  2. Connect to pc/mac enable usb debugging. 连接到pc / mac启用USB调试。 Find the package name of your default launcher using this command. 使用此命令查找默认启动器的程序包名称。 " adb shell pm list packages " adb shell pm列表包
  3. Disable the default launcher " adb shell pm hide com.android.yourlauncher " 禁用默认启动器“ adb shell pm hide com.android.yourlauncher

done. 完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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