无法接收在Android解析推送通知

无法接收在Android解析推送通知

本文介绍了无法接收在Android解析推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发简单的Andr​​oid应用程序,非常新的解析。我跟着增加后端功能解析文档。解析CORE是一个容易的部分,但我无法从Android设备发送推送通知。但是,从仪表盘解析时发送接收推送通知。
我的清单文件如下:

I am developing simple android app and very new to parse. I followed parse documentation in adding back-end functionalities. Parse CORE was an easy part but I can’t send push notifications from android device. But push-notifications are received when sent from parse dashboard.My Manifest file is as below:

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

        <!--
          IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
          to match your app's package name + ".permission.C2D_MESSAGE".
        -->
        <permission android:protectionLevel="signature"
            android:name="loaniistar.loaniistar.permission.C2D_MESSAGE" />
        <uses-permission android:name="loaniistar.loaniistar.permission.C2D_MESSAGE" />

<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.ParsePushBroadcastReceiver"
            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" />

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

应用类:

public class MApplication extends Application {

    String applicationiId = "5npdddECsGdDk49OttttuHq6iZdZpddI0cHDsz";
    String clientKey = "SjF1BWamssstycthSjf2dddduhcuwW2VccccCCuFlE";

    public UserAccounts userAccount = null;

    @Override
    public void onCreate() {
        super.onCreate();

        Parse.enableLocalDatastore(this);
        ParseCrashReporting.enable(this);
        Parse.initialize(this, applicationiId, clientKey);
        PushService.startServiceIfRequired(this);
    }

}

在活动课订阅通道:

Subscribing for channel in an activity class:

ParsePush.subscribeInBackground("manager", new SaveCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {

                        }
                        else
                        {
                            btnLoginEnable();
                        }
                    }
                });

在另一个活动课发送推送通知:

Sending Push Notification in another activity class:

 // Sending Push
                    ParsePush push = new ParsePush();
                    push.setChannel("manager");
                    push.setMessage(m.getMessage().substring(0, (int) m.getMessage().length() / 3));
                    //push.sendInBackground();
                    push.sendInBackground(new SendCallback() {
                        @Override
                        public void done(ParseException e) {
                            if(e == null)
                            {
                                Toast.makeText(getActivity(), "Notification sent", Toast.LENGTH_SHORT).show();
                            }
                            else {
                                Toast.makeText(getActivity(), "Notification Not sent", Toast.LENGTH_SHORT).show();
                            }
                        }
                    });

行中的安装类添加和GCMSenderId是空的!这是问题?
从我的Andr​​oid设备发送的时候请帮我为什么我无法收到通知?
库使用:
螺栓,Android的1.1.4.jar
解析-1.8.2.jar
ParseCrashReporting-1.8.2.jar

Row is added in "Installation" class and GCMSenderId is empty!! Is this the issue?Please help me out why I can’t receive notifications when sent from my android device?Libs used:Bolts-android-1.1.4.jarParse-1.8.2.jarParseCrashReporting-1.8.2.jar

推荐答案

如果您刚才创建的应用程序的分析和集成到应用程序,它一般不会马上工作同样的事情发生在我身上。我没有得到的数据,但一段时间后,当我看到解析仪表板我的要求

If you have just created the App in Parse and integrated in your App, It generally not works immediately Same thing happened to me. I was not getting the data, but after some time I got the requests when I saw the Parse Dashboard

这将需要大约20分钟。 您可以尝试看看解析分析。(如果你已经实现了它)如果解析显示您的分析仪表板的要求然后将工作完全没问题。

It will take Approx 20 mins. You can try to see the Parse Analytics.(if you have implemented it) if Parse shows Requests in your Analytics Dashboard then It will work completely fine

这篇关于无法接收在Android解析推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:21