Parse.com 推送通知不工作

Parse.com Push Notification not working

我根本收不到推送通知。我的接收器 class 中的 onPushReceieved 方法从未被调用。

这是我的清单的样子:

<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

这是我的应用程序 onCreate 方法中用于 Parse 的初始化方法:

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

这是我的接收器 class 的 onPushReceived 方法:

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

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

}

我永远看不到那个日志。 OnPushReceive 永远不会被调用。有什么我想念的吗?

我听说 parse.com 将永远关闭

是的,它正式关闭了。 http://parse.com/

编辑

由于 parse 最近宣布关闭,GCM 是唯一的最佳选择,尽管它没有管理界面。 为此,您可以按照这个很棒的教程进行操作。 http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-1/

我想通了。

我很久以前就换过包裹了。我对我的清单进行了更改,但没有在我的 gradle 文件中进行更改。

感谢 Taylor Courtney 继续帮助我解决问题。他是真正的MVP。

检查你的清单和 gradle 文件,我认为包名是错误的。