So currently at my wits end for this issue.
I am trying to set my app as the default app launched when long pressing the Home button.
I am doing this by:
<action android:name="android.intent.action.ASSIST" /> <action android:name="android.intent.action.SEARCH_LONG_PRESS" /> <category android:name="android.intent.category.DEFAULT" />
Intent intent = new Intent(Intent.ACTION_ASSIST); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
This approach works perfectly fine for devices running pre 6.0 software. On post 6 devices the request is asked but the default assistant app is unchanged.
My app can be set as the default home app on post 6 devices perfectly fine when using these exact steps.
I'm unsure as to whether there's some kind of specific permission I'm missing or something. Nothing seems to work at all. The google app will always be used on long press. If I disable the google app then my app will run on long press.
Extra information: This is a kiosk app for business so I prefer to not have to disable the Google app for every single device this will go on. I don't mind if solutions are hacky as this is not going on the app store.
Change your default phone assistant From Settings, search for and select Device assistance app. Tap Device assistance app again, and a list of available assistants will appear. Choose your desired option, and then tap OK.
A default app is the one you'd like your operating system to use to open certain files or links. Understandably, out of the box, Android defaults to Google applications. For instance, the default web browser for Android is Chrome.
To implement your Assistant like app, the assistant app must provide an implementation of VoiceInteractionSessionService
and VoiceInteractionSession
.
It also requires the BIND_VOICE_INTERACTION
permission.
See also:
Implementing Your Own Assistant
VoiceInteraction sample app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With