谷歌应用程序C2D_MESSAGE没有定义的权限? [英] Google C2D_MESSAGE Application does not define permission?

查看:2590
本文介绍了谷歌应用程序C2D_MESSAGE没有定义的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在code有问题,我只是遵循了谷歌指南GCM推送消息,并正在此错误:

i have problem in my code, I've just followed the google guide for GCM push messaging and am getting this error:

06-07 10:51:04.371: E/AndroidRuntime(29686): FATAL EXCEPTION: main
06-07 10:51:04.371: E/AndroidRuntime(29686): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.droidersuin.project/com.droidersuin.pushnotifications.PushMainActivity}: java.lang.IllegalStateException: Application does not define permission com.droidersuin.project.permission.C2D_MESSAGE
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1959)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1984)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.app.ActivityThread.access$600(ActivityThread.java:126)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1150)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.os.Looper.loop(Looper.java:137)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at android.app.ActivityThread.main(ActivityThread.java:4456)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at java.lang.reflect.Method.invokeNative(Native Method)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at java.lang.reflect.Method.invoke(Method.java:511)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
06-07 10:51:04.371: E/AndroidRuntime(29686):    at dalvik.system.NativeStart.main(Native Method)
06-07 10:51:04.371: E/AndroidRuntime(29686): Caused by: java.lang.IllegalStateException: Application does not define permission com.droidersuin.project.permission.C2D_MESSAGE
06-07 10:51:04.371: E/AndroidRuntime(29686): 

和本我的清单

 <activity
        android:name="com.droidersuin.pushnotifications.RegisterPushActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:label="@string/app_name" >

    </activity>

    <activity
       android:name="com.droidersuin.pushnotifications.PushMainActivity"
         android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:configChanges="keyboardHidden|orientation" >
    </activity>

    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        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="com.droidersuin.pushnotifications" />
        </intent-filter>
    </receiver>

    <service android:name="com.droidersuin.pushnotifications.GCMIntentService" />


</application>

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />  
<permission 
    android:name="com.droidersuin.pushnotifications.permission.C2D_MESSAGE" 
    android:protectionLevel="signature"/>
<uses-permission android:name="com.droidersuin.pushnotifications.permission.C2D_MESSAGE" /> 
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

这是我的包:

任何机构帮助我..?我希望有人能够帮助这一点,总是令人沮丧,当你在下面的教程。

any body help me.. ? I hope someone can help with this, always frustrating when you are following a tutorial.

推荐答案

添加权限后,它应该是这个样子。

After adding the permission, it should be look like this

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

这篇关于谷歌应用程序C2D_MESSAGE没有定义的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆