Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set app as default Assist Intent

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:

  1. Setting Intent Filters in the manifest (I also experimented with adding MAIN and LAUNCHER action/category tags)
 <action android:name="android.intent.action.ASSIST" />
 <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
 <category android:name="android.intent.category.DEFAULT" />
  1. Requesting the default app on an intent to allow users to change (there's also one for the Search Long Press action)
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.

like image 586
C. Carter Avatar asked Jun 26 '18 03:06

C. Carter


People also ask

How do I change my default assist app?

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.

What does set as default mean on my phone?

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.


1 Answers

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

like image 58
Man Avatar answered Oct 13 '22 01:10

Man