处理Home键Android的开发锁屏Home、Android

2023-09-12 05:54:23 作者:点燃一根烟

我开发锁屏应用程序,我需要禁用的主页按钮。 有人告诉我留在清单中的类别为默认值,但家里当过设备引导完成我的活动推出,但不是finishing.because我我的应用程序是家庭如何处理家庭button.How GO锁屏应用程序处理的主页按钮

I am developing lock screen application for that i need to disable the home button. some one told to me kept in the manifest as category as default, home but when ever device boot completed my activity launches but not finishing.because I my application is home How to handle the Home button.How Go locker application handled Home button

 <intent-filter>
             <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>

请给我一个合适的建议,我会非常感谢你。

please give me a proper suggestion i would very thankful to you.

推荐答案

您需要添加:

<category android:name="android.intent.category.LAUNCHER" />

让你充分的意图,滤波部分看起来是这样的:

so your full intent-filter section looks like this:

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

不是这仍然不会强制应用程序在启动运行。这将只是它添加到发射器的列表。它只会推出在启动如果用户选择它作为自己的默认启动。

Not this still won't FORCE the app to run at boot. This will just add it to the list of launchers. It will only launch at boot if the user chooses it as their default launcher.

如果你想运行在推出一个活动,你可以注册一个广播接收器处理ON_BOOT_COMPLETED动作,但非常仔细地在这样做之前;难道这就是你的应用程序的所有用户都希望?

If you want to run an activity at launch, you can register a broadcast receiver to handle the ON_BOOT_COMPLETED action, but think very carefully before doing so; is this what all users of your app would want?