现在 Android 10 及更高版本具有此功能,我正在尝试添加它。将其包含在清单中:
<action android:name="android.intent.action.ASSIST"/>
这是代码:
mRM = (RoleManager) mAppContext.getSystemService(Context.ROLE_SERVICE);
bAvailable = mRM.isRoleAvailable(RoleManager.ROLE_ASSISTANT);
if (bAvailable) {
roleIntent = mRM.createRequestRoleIntent(RoleManager.ROLE_ASSISTANT);
startActivityForResult (roleIntent, REQUEST_CODE);
}
但是,我不断收到此错误:
RequestRoleActivity: Role is not requestable: android.app.role.ASSISTANT
RequestRoleFragment: Role request result requestingUid=10021 requestingPackageName=com.broadcom.BcmMicCapture roleName=android.app.role.ASSISTANT qualifyingCount=-1 currentUid=-1 currentPackageName=null grantedAnotherUid=-1 grantedAnotherPackageName=null result=1
知道这里有什么问题吗?这是一个sepolicy问题吗?还是应用程序需要添加一些其他权限?