【发布时间】:2015-07-15 14:08:36
【问题描述】:
我正在尝试将推送通知从解析发送到 android。从浏览器发送它时,设备的计算正在正确显示。但是浏览器中显示的是“Pushes sent 0”。
我在应用程序类中注册通知
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);
}
}
});
ParseInstallation.getCurrentInstallation().saveInBackground();
我还在我的 android 项目中创建了Receiver
public class PushMessageBroadcast extends ParsePushBroadcastReceiver {
@Override
public void onPushOpen(Context context, Intent intent) {
Log.d("The push","open");
}
@Override
protected Notification getNotification(Context context, Intent intent) {
// TODO Auto-generated method stub
return super.getNotification(context, intent);
}
@Override
protected void onPushDismiss(Context context, Intent intent) {
// TODO Auto-generated method stub
super.onPushDismiss(context, intent);
}
@Override
protected void onPushReceive(Context context, Intent intent) {
//here You can handle push before appearing into status e.g if you want to stop it.
super.onPushReceive(context, intent);
}
}
我也做了manifest的改动:
<receiver
android:name=".receivers.PushMessageBroadcast "
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>
我需要更改解析中的任何设置吗?提前致谢。
【问题讨论】:
-
尝试将通知发送到所有设备而不是特定频道,看看是否有效
-
它将始终显示为 0 几分钟。如果在发送推送通知后等待一段时间然后刷新,它应该会更新到正确的设备数量。
标签: java android parse-platform push-notification