简体   繁体   English

解析通知在Android中不起作用

[英]Parse Notification not working in Android

Parse notification not receiving in android app from Parse Server. 无法从Parse Server在Android应用中接收到解析通知。

In Below link it shown notification is not sent with Push sent 0 on parse serve 在下面的链接中,它显示的通知未发送,而在解析服务上发送的推送为0

https://www.parse.com/apps/bluejay-test/push_notifications/mmBUWvc8US https://www.parse.com/apps/bluejay-test/push_notifications/mmBUWvc8US

Also in Parse Account Client push enabled is Yes. 同样在“解析帐户”中,启用了“客户端推送”的是。

I am sending the push notification from parse cloud server its not receiving in android APP but receive in ios APP .Its sometime come in android mobile. 我正在从解析云服务器发送推送通知,它在android APP中没有接收,但在ios APP中接收。它有时在android mobile中传入。

Please suggest me what is the issue? 请建议我是什么问题?

In Login User Time, I am using this code 在“登录用户时间”中,我正在使用此代码

ParseInstallation.getCurrentInstallation().put("uuid",user.getUuid());
ParseInstallation.getCurrentInstallation().put("email",parseUser.getEmail());
ParseInstallation.getCurrentInstallation().put("uuid",user.getUuid());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
@Override
                public void done(ParseException arg0) {

                                 }});

and also also followed all the trouble shooting steps and added the configuration in AndroidManifest.xml 并且还遵循了所有解决问题的步骤,并在AndroidManifest.xml中添加了配置

<permission
        android:name="com.redblink.bluejay.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.redblink.bluejay.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<receiver
            android:name="com.redblink.bluejay.CustomParsePushBroadcastReceiver"
            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>

        <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" />
                    <category android:name="com.redblink.bluejay" />


            </intent-filter>
        </receiver>

I have added the CustomParsePushBroadcastReceiver for receiving the notification 我添加了CustomParsePushBroadcastReceiver来接收通知

public class CustomParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {
    private String TAG ="CustomParsePushBroadcastReceiver"    ;
    BlueJayApplication application;
    @Override
    public void onReceive(Context context, Intent intent) {
        BlueJayApplication application = (BlueJayApplication) context.getApplicationContext();

        Bundle e = intent.getExtras();

        for (String key : e.keySet()) {

            BluejayDebug.Log(TAG, "Extra: " + key);
            BluejayDebug.Log(TAG, "" + e.getString(key));
        }

        BluejayNotificationManager.Init(context);
        BluejayNotificationManager.getInstance().sendGenericNotification("BlueJay", "New bluejay event");

    }

    public void setApplication(){


    }
}

Modify this 修改这个

   <receiver
        android:name="com.redblink.bluejay.CustomParsePushBroadcastReceiver"
        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>

To this 对此

<receiver android:name="com.redlink.bluejay.CustomParsePushBroadcastReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>

The function you should be overriding is onPushReceive() not onReceive(). 您应该重写的函数是onPushReceive()而不是onReceive()。 Change the function and that will fix the issue. 更改功能,将解决此问题。

The documentation explains that. 该文档对此进行了解释。 https://parse.com/docs/android/api/com/parse/ParsePushBroadcastReceiver.html https://parse.com/docs/android/api/com/parse/ParsePushBroadcastReceiver.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM