解析推送通知don';不会出现在Android上的通知栏上
我有一个用Android开发的应用程序。我正在使用并使用parse.com发送它们 应用程序运行时会收到通知,但当应用程序处于后台时,通知不会显示在通知托盘上。我收到这样的消息:解析推送通知don';不会出现在Android上的通知栏上,android,parse-platform,push-notification,ionic-framework,Android,Parse Platform,Push Notification,Ionic Framework,我有一个用Android开发的应用程序。我正在使用并使用parse.com发送它们 应用程序运行时会收到通知,但当应用程序处于后台时,通知不会显示在通知托盘上。我收到这样的消息: notification = { payload: { data: { alert: "message", } } } 但是,当我直接通过CGM发送它们时,通知确实会出现在通知栏上。我收到的物体是这样的: notification = { message: "this appe
notification = {
payload: {
data: {
alert: "message",
}
}
}
但是,当我直接通过CGM发送它们时,通知确实会出现在通知栏上。我收到的物体是这样的:
notification = {
message: "this appear on notification tray",
payload: {
message: "this appear on notification tray"
}
}
解析有什么问题吗?还是我缺少了一些关于解析的信息?这是一篇老文章,但我使用Xamarin和解析推送通知遇到了这个问题,但我的解决方法可能对您(以及将来可能看到这一点的其他人)有用 我在收到解析通知后广播了一个本地推送通知 首先为解析通知事件分配一个接收者:
ParsePush.ParsePushNotificationReceived += PushNotificationReceived;
然后在方法中:
void PushNotificationReceived (object sender, ParsePushNotificationEventArgs e)
{
var payload = JObject.Parse (e.StringPayload); // Parse the JSON payload
Notification.Builder builder = new Notification.Builder (this);
builder.SetContentTitle (payload ["alert"].ToString ());
builder.SetContentText (payload ["androidDetail"].ToString ()); // Note: this is another field I added to the Parse Notification
builder.SetDefaults (NotificationDefaults.Sound | NotificationDefaults.Vibrate);
builder.SetSound (RingtoneManager.GetDefaultUri (RingtoneType.Notification));
builder.SetSmallIcon (Resource.Drawable.small_notification_icon);
var largeIcon = BitmapFactory.DecodeResource (Resources, Resource.Drawable.large_notification_icon);
builder.SetLargeIcon (largeIcon);
var notification = builder.Build ();
notification.Defaults |= NotificationDefaults.Vibrate;
NotificationManager notManager = (NotificationManager)GetSystemService (Context.NotificationService);
notManager.Notify (0, notification);
}
希望这有助于你和任何其他人谁遇到这个 嘿,你能分享你的代码吗(你使用ngCordova设置解析推送通知的方式)