android - "Permission Denial: receiving Intent "的原因

标签 android android-intent android-c2dm

我成功地让这些 c2dm 实现在我的应用程序上运行。

当设备突然没有收到 c2dm 消息时,我遇到了一个问题。 这次它拒绝了我的许可,我对此感到困惑:

Permission Denial: receiving Intent {
act=com.google.android.c2dm.intent.REGISTRATION cat=[myapp.android] (has extras) } to myapp.android requires myapp.android.permission.C2D_MESSAGE due to sender com.google.android.location (uid 10037)

第二次发生在我身上,我不能只是告诉我的用户他们需要在没有收到任何命令时执行恢复出厂设置。 这里有人遇到过类似的问题吗?任何帮助或见解和原因将不胜感激。

要求的manifest.xml


   <receiver
        android:name="myapp.EmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="myapp" />
        </intent-filter>
    </receiver>

...

<uses-permission android:name="myapp.android.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.INTERNET" />

最佳答案

对我来说,在我定义如下之后它就起作用了:

<permission android:name="mypkg.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="mypkg.permission.C2D_MESSAGE"/>

其中 mypkg = 是我的应用程序包

关于android - "Permission Denial: receiving Intent "的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13907529/

相关文章:

android - 在android中以两秒的间隔时间按顺序显示图像

android - CollapsingToolbarLayout 与 FloatingActionButton 错误

android - 使用 Robolectric 测试该按钮启动 Activity

android - 更新通过 Parcelable Intent 传递的对象

java - 当人们停止使用您的小部件时如何释放相机?

java - 对象 HashMap 内存/引用问题

android - 检索以前的输入 Android

Android - 无法接收 C2DM 注册意向

php - 如何在 Android 中为 C2DM 获取客户端登录授权 token

Android C2DM 注册 ID 有效期