Bart Bergmans
Bart Bergmans

Reputation: 4121

Parse deviceToken empty after ParseInstallation save

I am working on an app where I use Parse to send and receive notifications. The problem now is that when I register an installation deviceToken is empty (deviceType and installationId aren't empty). When this token is empty I can't receive any notifications.

How I register the installation:

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

When I added all the code for Parse to my app (https://www.parse.com/apps/quickstart#parse_push/android/native/existing) everything was working fine.

My 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>

I just created a new application, added Parse and deleted the Installation class/table in Parse but still no deviceToken.

Upvotes: 3

Views: 1352

Answers (1)

Bart Bergmans
Bart Bergmans

Reputation: 4121

I think it's a bug in the new Parse SDK. I downgraded to 1.9.0 and everything works fine now.

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

Upvotes: 4

Related Questions