Android M : Billing and GCM permissions

2019-02-16 08:38发布

问题:

I have an app which use GCM and Billing. In order to make it Android M-ready i'm trying to implement the new permission model.

Unfortunately i can't find any informations about GCM and Billing permissions. They don't appear in the normal permission list and are obviously not available with Manifest.permission.* because they are not under android.permission namespace.

Nevertheless , we still have to declare them in the manifest

<uses-permission android:name="com.android.vending.BILLING">
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE">

So how those permissions should be handled ? Are they automatically granted ?

回答1:

Those permissions are granted automatically at install time:

checkSelfPermission("com.android.vending.BILLING") returns PERMISSION_GRANTED without ever asking the user.

As far as I understood the documentation and the behaviour of the most recent M preview, the only permissions that have to be requested at runtime are the ones that have a permission group, since the popups that are prompted to the user only mention permission groups.