Rahul
Rahul

Reputation: 1627

Unable to send/receive push notification using parse.com console

I am aware that this question has been asked earlier, but I have tried all the things including the tutorial provided on parse.com.

So I am trying to send notification using parse web console. But I am unable to do so, in web console it is showing that notification has been sent to 0 device.

So here is the code snippet: In my main activity

Parse.initialize(this, "ABC", "XYZ");
PushService.setDefaultPushCallback(this, TodoListActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();

In my AndroidManifest.xml

permission:

<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.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<permission
    android:name="com.parse.offlinetodos.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.parse.offlinetodos.permission.C2D_MESSAGE" />

service and reciever part:

<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="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" />

        <!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
        <category android:name="com.parse.offlinetodos" />
    </intent-filter>
</receiver>

From the console, I am just trying to send a plain text push notification.

Please help me out, what am I missing ?

Upvotes: 0

Views: 45

Answers (1)

user3764003
user3764003

Reputation: 95

You need to put this

Parse.initialize(this, "ABC", "XYZ");
    PushService.setDefaultPushCallback(this, TodoListActivity.class);
    ParseInstallation.getCurrentInstallation().saveInBackground();

to another File which extends Application class

then on you manifest

<application
 android:name="com.package.ApplicationFileThatContainsTheParseKey">
... 
</application>

Upvotes: 1

Related Questions