简体   繁体   中英

how to fix this "Unable to trigger default handler prompt prior to runtime permissions"

Today i received this mail from google team my app publishing status: Rejected.

Unable to trigger default handler prompt prior to runtime permissions *If your app is a default handler, the default handler prompt must precede the runtime permission prompt.

Based on our review, your app doesn't appear to properly trigger the default handler prompt prior to the runtime permissions prompt. Please add the default handler prompt prior to any runtime permissions prompt.*

Please help for solve this and i also used default handler prompt but don't know why google sent me this mail.

You need to explicitly prompt the default handler instead of simply declaring permissions in the manifest.

RoleManager roleManager = (RoleManager) 
activity.getSystemService(Context.ROLE_SERVICE);
Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_DIALER);
activity.startActivityForResult(intent, requestCode);

For changing the default handler:

Intent setDefaultSmsIntent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
setDefaultSmsIntent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getPackageName());
startActivityForResult(setDefaultSmsIntent, requestCode);

From Google's Android documentation, this about the Play Store policy .

Given the sensitive user information that an app accesses while serving as a default handler, your app cannot become a default handler unless it meets the following Play Store listing and core functionality requirements:

Your app must be able to perform the functionality for which it's a default handler. For example, a default SMS handler should be able to send text messages.

Your app must provide a privacy policy.

Your app must make its core functionality clear in the Play Store description.

For example, a default Phone handler should describe its phone-related capabilities in the description.

Your app must declare permissions that are appropriate for its use case. For more details about which permissions you can declare as a given handler, see the guidance on using SMS or call log permission groups in the Play Console Help Center.

Your app must ask to become a default handler before it requests the permissions associated with being that handler. For example, an app must request to become the default SMS handler before it requests the READ_SMS permission.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM