1

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.

hareesh J
  • 520
  • 1
  • 6
  • 21
  • You cannot disable home button, you have added a category for HOME then user is prompted to make choice, you if you want to read more on it then google how to create your own launcher like these http://arnab.ch/blog/2013/08/how-to-write-custom-launcher-app-in-android/ http://forum.xda-developers.com/showthread.php?t=2583692 http://developer.eclipsesource.com/tabris/docs/1.2/launcher/android/ – Girish Nair May 07 '14 at 09:24
  • hey @hareesh145 how can you accept a answer which is not working . – Sagar Nayak May 22 '16 at 06:44

1 Answers1

1

You need to add:

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

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?

LairdPleng
  • 948
  • 3
  • 9
  • 28
  • I am developing lock screen application there no way to disable to home button every one saying by making your application as home and default please suggest me how to make my application as lock screen which will not crash device @LairdPleng – hareesh J Mar 25 '14 at 05:13
  • I don't know how to make a lock screen app, it's something I've had no experience in. I suggest you edit your question to state what you are trying to achieve. Also, if your app is crashing then post the log cat. – LairdPleng Mar 25 '14 at 06:55
  • I tried this also but it is not working Thanks for reply – hareesh J Mar 25 '14 at 07:56
  • As your answer is accepted. I dont find the answer to the question asked. So please tell me how to disable the home button for my screen locker app. – Sagar Nayak May 21 '16 at 13:51
  • Quite simply, you can't. On 5.0 and above you can enter kiosk mode (screen pinning) but you can't FORCE screen pinning unless you have created a device administrator app - which is only suitable in a corporate environment as it involves a lot of ADB or NFC work *before* any other account (including a google account) has been added to the device. – LairdPleng May 22 '16 at 06:23
  • looks like you have a good knowledge @LairdPleng but please see any screen lock app and run in lollipop it disable the lock screen . can you explain how ? – Sagar Nayak May 22 '16 at 06:43
  • Sorry this answer was written incorrectly; I believed the OP was wishing to make an app which locks the screen, not a lockscreen app, which I have no experience in. I don't know why the answer was even accepted int he first place, then. – LairdPleng May 22 '16 at 08:08