简体   繁体   English

Parse.com推送通知未发送

[英]Parse.com push notifications not sending

I have ran my application on two devices, on the screen to send push notifications it tells me there will be 2 recipients. 我已经在两个设备上运行了我的应用程序,在屏幕上发送了通知,通知我将有2个收件人。 However when I send the notification nothing appears on the phone. 但是,当我发送通知时,电话上什么也没有显示。

on the screen that shows the list of push notifications sent I can see my notifications, with the target "Everyone" and the "Pushes Sent" field is "0" 在显示已发送的推送通知列表的屏幕上,我可以看到我的通知,目标为“所有人”,“发送的推送”字段为“ 0”

here is my application class; 这是我的应用程序类;

import android.app.Application;
import android.util.Log;

import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseInstallation;
import com.parse.ParsePush;
import com.parse.PushService;
import com.parse.SaveCallback;


/**
 * Created by andrew on 31/07/15.
 */
public class android extends Application {

    @Override
    public void onCreate() {
        Parse.initialize(this, "KEY HERE", "KEY HERE");
        Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
        ParseInstallation.getCurrentInstallation().saveInBackground();

        ParsePush.subscribeInBackground("", new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
                } else {
                    Log.e("com.parse.push", "failed to subscribe for push", e);
                }
            }
        });

        PushService.setDefaultPushCallback(this, LoginActivity.class);


        System.out.println(ParseInstallation.getCurrentInstallation().toString());
        super.onCreate();

    }
}

and here is my manifest; 这是我的清单;

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.my.app.android" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <permission android:protectionLevel="signature"
        android:name="com.my.app.android.permission.C2D_MESSAGE" />

    <uses-permission android:name="com.my.app.android.permission.C2D_MESSAGE" />


    <application
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@drawable/launcherid"
        android:label="mEnquirer"
        android:name=".android"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme" >

<!-- Activitys where here -->

        <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="com.my.app.android" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

I managed to fix this, turns out I had changed the package name in my manifest at some point and this was confusing parse. 我设法解决了这个问题,事实证明我在某个时候更改了清单中的软件包名称,这使解析变得混乱。

I created a new project and copied my code to it and everything works now. 我创建了一个新项目,并将代码复制到该项目中,现在一切正常。

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

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