i have tried different approaches to disable hardware home button through key-guard and key-down. it didn't work, i want functionality like Go-locker app. when i press on home button activity didn't close. please give me any idea about it. Thanks in advance.
Write this Intent filter in manifest in tag of your activity
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Because the security reason, if any app can disable Home button, and also disables back button (onbackpress()), power button (by on/off receiver), so the app will never be killed, and your phone just shows the app. I think Go-locker has customed their laucher, you can do it, but i think it is not easy.
Regards !
Related
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.
I have already finished an Android lock-screen app but my teacher asks me to change it into an app using Windowmanager so that users can not exit the app using HOME button. The idea is that we can make the whole app be a float full-screen window. But I don't know how to change a finished activity into a float window.
You just can't override the HOME button (or "make the HOME button unwork").
There was a time, about in Android 1.6 when you could do that, against Google's wishes. But now you just can't.
Think about it. If you could do that, some app you downloaded from the PlayStore could do that and render your phone unusable.
The closest you can get is adding CATEGORY_HOME as an intent of one of your activities. That way when the user touches the HOME button, he will be presented with the option to choose which activity will open when they touch HOME.
Here you've got an example on how to do it (you don't have to change anything in the Activity classs):
<activity
android:name="com.mpascual.example.HomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This line is the relevant one (everything else is just an example):
<category android:name="android.intent.category.HOME"/>
I have a bluetooth headset which is able to communicate with my phone. It has one large 'call' button which answers/ends calls.
I am trying to make an app which will be able to intercept when the call button is pressed. I have tried using an intent filter:
<receiver android:name=".MediaButtonIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
but the call button does not appear to be classified as a media_button
any ideas on how I can achieve this? I would just like to know when the call button is pressed
try
android.intent.action.CALL_BUTTON
http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL_BUTTON
I'm not sure about it.. I think it fires for all call buttons, including any physical call buttons on the phone and buttons on the headsets .etc.
If the button is currently bringing up the Voice Dialer (mine does), you want ACTION_VOICE_COMMAND. Add the following to your intent filter:
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
I'm looking for an intent-filter, like android.intent.category.HOME, that will allow an app to launch when the HOME button is pressed, only for a long press.
Or any other method for achieving the same result...
I read that it was possible in the past but was disable for security reasons... is that true?
Thanks!
It is doable now since Android 4.1
Simply, add the following and place them inside the main activity element of your AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Then reinstall your application, long press the home button your App will be listed in "Complete action with".
I'm looking for an intent-filter, like android.intent.category.HOME, that will allow an app to launch when the HOME button is pressed, only for a long press.
This is not supported by Android, sorry.
I'm building a home screen application for android and I'd like to disable (temporary) the default home screen (TwLauncher) or whatever app is running.
Is there any way to accomplish this?
You can't disable other homescreens, but you can register your app as a homescreen by adding the appropriate intent-filters to your manifest:
<activity android:name="Home"
android:theme="#style/Theme"
android:launchMode="singleInstance"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Different homescreens can exists concurrently, the user ultimately decides which homescreen he wants to set as his default homescreen manually.
Please have a look to this sample code on the official website : Home app sample
I also encounter that problem here is the solution go to preferences of your default launcher look for exit for ex: exit go launcher ex then ok. This will disable the default.