ParseInstallation保存后解析deviceToken为空

时间:2015-07-07 13:52:11

标签: android parse-platform

我正在使用Parse来发送和接收通知的应用。现在的问题是,当我注册安装时,deviceToken为空(deviceType和installationId不为空)。当此令牌为空时,我无法收到任何通知。

我如何注册安装:

Parse.initialize(this, "x", "x");
ParseInstallation.getCurrentInstallation().saveInBackground();

当我将Parse的所有代码添加到我的应用程序(https://www.parse.com/apps/quickstart#parse_push/android/native/existing)时,一切正常。

我的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xxx.xxx" >

    <uses-sdk android:maxSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

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

    <application
        android:name="com.xxx.xxx.Name_"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:logo="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <meta-data
            android:name="com.google.android.gms.analytics.globalConfigResource"
            android:resource="@xml/global_tracker" />

        <activity
            android:name="com.xxx.xxx.Activities.SplashActivity_"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.xxx.xxx.Activities.LoginActivity_"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="com.xxx.xxx.Activities.ForgotPassword_"
            android:screenOrientation="portrait"
            android:label="@string/app_name">
        </activity>
        <activity
            android:name="com.xxx.xxx.Activities.MainActivity_"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="com.xxx.xxx.Activities.EditProfile_"
            android:screenOrientation="portrait"
            android:label="@string/edit_profile" >
        </activity>

        <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
            </intent-filter>
        </receiver>
        <service android:name="com.google.android.gms.analytics.AnalyticsService"
            android:enabled="true"
            android:exported="false"/>

        <service android:name="com.parse.PushService" />
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
        <receiver android:name=".Receiver.MyPushBroadcastReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.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.xxx.xxx" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

我刚刚创建了一个新的应用程序,添加了Parse并删除了Parse中的Installation类/表,但仍然没有deviceToken。

1 个答案:

答案 0 :(得分:4)

我认为这是新Parse SDK中的一个错误。我降级到1.9.0,现在一切正常。

来源:https://groups.google.com/forum/#!topic/parse-developers/a1Z0SSC304M