问题描述:

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.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.

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.

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

  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.

相关阅读:
Top