Java com.google.android.c2dm.permission.SEND权限未授予
我在清单中添加了com.google.android.c2dm.permission.SEND,如下所示Java com.google.android.c2dm.permission.SEND权限未授予,java,android,android-permissions,Java,Android,Android Permissions,我在清单中添加了com.google.android.c2dm.permission.SEND,如下所示 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.lewwe.broadcastsender"> <uses-permission andr
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lewwe.broadcastsender">
<uses-permission android:name="com.google.android.c2dm.permission.SEND" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
当我尝试从另一个需要com.google.android.c2dm.permission.SEND权限的应用程序与另一个广播接收器交互时,我收到以下错误日志:
03-31 07:44:21.648 675-691/? W/BroadcastQueue: Permission Denial: broadcasting Intent { flg=0x10 cmp=cn.wps.moffice_eng/cn.wps.moffice.main.gcm.GcmReceiver (has extras) } from com.example.lewwe.broadcastsender (pid=2680, uid=10077) requires com.google.android.c2dm.permission.SEND due to receiver cn.wps.moffice_eng/cn.wps.moffice.main.gcm.GcmReceiver
我认为我必须在运行时请求此权限。如果这是真的,我该怎么做
com.google.android.c2dm.permission.SEND权限由google Play services持有。这将防止其他应用程序调用广播接收器
你能用错误日志更新你的问题吗?你成功地做到了吗?
03-31 07:44:21.648 675-691/? W/BroadcastQueue: Permission Denial: broadcasting Intent { flg=0x10 cmp=cn.wps.moffice_eng/cn.wps.moffice.main.gcm.GcmReceiver (has extras) } from com.example.lewwe.broadcastsender (pid=2680, uid=10077) requires com.google.android.c2dm.permission.SEND due to receiver cn.wps.moffice_eng/cn.wps.moffice.main.gcm.GcmReceiver