1

I'm creating a lock screen app and I have a problem: If I use these intent filters in my lock activity:

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

so that I can handle home button press but the problem will be that when I reboot my phone/emulator my activity will run instantly(before on boot completed) and as home activity(I guess) and it won't proceed further and even after I unlock it by entering password(and call finish()) the activity launches again. Any idea how should I solve this?

EDIT: I thought of another way and that is to add intentFilters in run time this way I can avoid this problem but I don't know how to do it on activity and is it even possible?

P.S. I have searched for this a lot(more than one week constantly browsing stackoverflow) and many has suggested not to block home button but I need to so please help me.

M. Erfan Mowlaei
  • 1,376
  • 1
  • 14
  • 25
  • I didn't quite understand what the problem is, but you may want to look at kiosk mode being set via some system flags of Android Window http://stackoverflow.com/questions/26927850/how-to-make-activity-not-to-be-covered-by-the-recentapps – Mixaz Nov 19 '14 at 15:23
  • 1
    I have read that before and it didn't help, let me explain, when you use above tags for your activity in main, it causes home button to show your app so nobody can bypass my lock by pressing home(this is the good part) but the problem is that when I reboot the phone it will launch my activity before anything else(even before onBootCompleted) and even if I call finish() on it, it will start again as default home activity and it won't let other processes proceed or launch. – M. Erfan Mowlaei Nov 19 '14 at 16:12
  • And if you do not assign it as a home screen app, what happens? It would not start on boot up, and what is the problem then? – Mixaz Nov 19 '14 at 20:06
  • I can't handle "device home button" presses – M. Erfan Mowlaei Nov 20 '14 at 02:41
  • You may check my answer, I think will help you achieve what you want http://stackoverflow.com/a/28603790/3300883 – Miguel Feb 19 '15 at 10:21

0 Answers0