Ebad Saghar
Ebad Saghar

Reputation: 1127

Parse.com Push Notification not working

I am not able to receive push notifications at all. onPushReceieved method in my receiver class is never called.

Here's what my manifest looks like:

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

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

<application>
  .
  .


    <service android:name="com.parse.PushService" />
    <receiver android:name="com.compName.appName.helpers.MyParsePushReciever"
        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.compName.appName" />
        </intent-filter>
    </receiver>
</application

This is the init methods for Parse in my Applications onCreate Method:

    Parse.initialize(this, app_id, client_id);
    PushService.startServiceIfRequired(this);
    ParseInstallation.getCurrentInstallation().saveInBackground();

Here is my Receiver class's onPushReceived method:

@Override
protected void onPushReceive(Context context, Intent intent) {

    Log.i("hereeeeeeeeee === ", "on push recieve");

}

I am never able to see that Log. OnPushReceive never gets called. Is there something I am missing?

Upvotes: 0

Views: 90

Answers (3)

Taylor Courtney
Taylor Courtney

Reputation: 813

Check your manifest and gradle file, I think the package names are wrong.

Upvotes: 1

Ebad Saghar
Ebad Saghar

Reputation: 1127

I figured it out.

I had changed my package a long time ago. I had made changes to my manifest, but not in my gradle file.

Shout out to Taylor Courtney for continuing in helping me figure it out. He's the real MVP.

Upvotes: 1

Qadir Hussain
Qadir Hussain

Reputation: 8856

I heard about parse.com is going to be off forever

and yes its down officially. http://parse.com/

enter image description here

EDIT

As parse announced their shutdown recently, GCM is the only best option though it won’t comes with an admin interface. You can follow this awesome tutorial for this. http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-1/

Upvotes: 1

Related Questions