How to make an application default phone or Assist

2020-07-01 08:19发布

问题:

We have received a policy notice from playStore as:

Your app manifest requests the Call Log permission group (e.g. READ_CALL_LOG, WRITE_CALL_LOG, PROCESS_OUTGOING_CALLS)
It must be actively registered as the default Phone or Assistant handler on the device.

I am not able to understand what Assistant handler on the device. Any inputs or suggestions are most welcome.

what are the minimum requirements by the android application to fullfil the requirement.

回答1:

Check the documentation at: https://developer.android.com/reference/android/telecom/TelecomManager#ACTION_CHANGE_DEFAULT_DIALER

Sample code:

Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getActivity().getPackageName());
startActivity(intent);


回答2:

You can't make it the default programmatically. The entire point is the user gets to choose the default, so they can choose what app gets their texts and calls. You may be able to do it with root, but nothing else.



回答3:

By the way if your application is not a phone handler, but you still need them for functionality to work, you can try getting a waiver (see the last paragraph in the article): https://support.google.com/googleplay/android-developer/answer/9047303?hl=en so your app won't be a phone handler but still will be able to get those permissions.



回答4:

In addition to what marmor stated the updated documentation for android 10 Q states:-

This is no longer supported since Q, please use RoleManager.createRequestRoleIntent(String) with RoleManager.ROLE_DIALER instead.

The code actually worked when I followed freezo9 answer regarding intend filters in the manifest fie :- https://stackoverflow.com/a/55716209/7552894

adding these:-

<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.DIAL"/>

<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>

<data android:scheme="tel"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL"/>

<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>