未调用GCMIntentService onRegistered

时间:2014-11-25 15:55:47

标签: android-manifest google-cloud-messaging

我想注册GCM服务器之后,不会调用GCMIntentService的onRegister方法。

我认为我的清单文件中存在权限问题,但我不知道

我在这里打电话给寄存器:          GCMRegistrar.checkDevice(本);          GCMRegistrar.checkManifest(本);          String regId = GCMRegistrar.getRegistrationId(this);

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.onlab.tippgame.activity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="14" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".JatekActivity"
            android:label="@string/app_name" 
            android:configChanges="orientation|screenSize">
        </activity>
        <activity
            android:name=".RegisterActivity"
            android:label="@string/title_activity_register" >
        </activity>
        <activity
            android:name=".StartActivity"
            android:label="@string/title_activity_start" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>

                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="mypackage" />
            </intent-filter>
        </receiver>

        <service android:name=".GCMIntentService" android:enabled="true" />
    </application>

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

    <!--
     To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
     option is required to comply with the Google+ Sign-In developer policies


    -->
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />

    <!-- To retrieve the account name (email) as part of sign-in: -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="android.permission.VIBRATE" />



     <permission
    android:name="mypackage.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

    <uses-permission android:name="mypackage.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />


</manifest>

1 个答案:

答案 0 :(得分:0)