Saturday 30 June 2018

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.



from Set app as default Assist Intent

No comments:

Post a Comment