【发布时间】:2015-03-16 13:39:25
【问题描述】:
我正在为 Android 开发一个应用程序,它有一个使用 Parse (https://www.parse.com) 的推送通知系统。
我已经完全按照他们在教程中的说明在我的应用程序上设置了 Parse,并且它正在工作 - 如果我从 Parse 面板“手动”发送通知,它会毫无问题地收到。
但是当我尝试从应用程序内部发送推送通知时,推送永远不会到达它的目标通道,并且它也不会显示在 Parse 日志中。
看看我的代码:
public class Application extends android.app.Application {
public Application() {
}
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "MY_CODE", "MY_OTHER_CODE");
ParsePush.subscribeInBackground("");
ParsePush push = new ParsePush();
push.setChannel( "my_example_channel" );
push.setMessage( "Test message" );
push.sendInBackground( new SendCallback() {
@Override
public void done(com.parse.ParseException e) {
if (e == null) Log.d("push", "success!");
else Log.d("push", "failure");
}
});
}
回调返回 null - 不显示错误并记录“成功”,并且我用来测试应用程序的其他手机订阅了“my_example_channel” - 如果我通过 Parse 发送通知,它会收到通知仪表板。
我还尝试将“推送发送代码”(之前的代码,没有“Parse.initialize...”和“parsePush.subscribeInBackground...”部分)放在按钮单击和Activity的"onCreate"方法,但是结果是一样的。
【问题讨论】:
标签: android parse-platform notifications push