简体   繁体   English

无法从BroadcastReceiver的onReceive接收Rich Rich通知的意图

[英]Can't receive intent from BroadcastReceiver 's onReceive for Rich Push notification

With the Urban airship's library, I was able to implement the push notification ok. 有了Urban飞艇的图书馆,我就可以实现推送通知了。 Which will trigger the onReceive() method every time I send push a message from a server. 每当我从服务器发送推送消息时,该方法都会触发onReceive()方法。

But when I switch to use PushRich notification, whenever I send out a rich message, it won't triiger the onReceive() method. 但是,当我切换为使用PushRich通知时,每当我发送丰富消息时,它都不会触发onReceive()方法。

I want to be able to achieve the same way it dose with the push notification in here. 我希望能够实现与此处的推送通知相同的方式。 I tried the richpush simple code from the website, but it seems to be having the same problem. 我从网站尝试了richpush简单代码,但似乎有同样的问题。

The fact that I think its possible its because from the sample code onReceive() method has the following code in it. 我认为有可能这样的事实,因为在示例代码中onReceive()方法具有以下代码。

// Ignore any non rich push notifications
        if (!RichPushManager.isRichPushMessage(intent.getExtras())) {
            return;
        }

Would it mean, it should send intent when we send rich push from server ? 这是否意味着,当我们从服务器发送丰富推送时,它应该发送意图?

Problem has been solved. 问题已解决。 After more digging into the Urban airship library. 之后更多地进入市区飞艇图书馆。 The rich message that contains HTML is actually be put into part of the push message JSON object. 实际上,包含HTML的丰富消息将被放入推送消息JSON对象的一部分。 Looks like such in a simple push message 在简单的推送消息中看起来像这样

{
"audience" : { "tag" : [ "tag1", "tag2" ] },
"device_types" : [ "ios" ],
"notification" : { "alert" : "New message!" },
"message" : {
    "title" : "Message title",
    "body" : "<Your message here>",
    "content_type" : "text/html"
}

} }

The "message" object is actually the Rich message itself. “消息”对象实际上是Rich消息本身。 So therefore, catching the intent for a simple push message can from then determine if a rich message exist in the intent. 因此,从那时起,捕获简单消息的意图就可以确定意图中是否存在丰富消息。

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

相关问题 Monodroid Intent Service的BroadcastReceiver没有触发OnReceive - Monodroid Intent Service's BroadcastReceiver not firing OnReceive android Notification不会触发BroadcastReceiver的onReceive - android Notification doesnt trigger BroadcastReceiver's onReceive BroadcastReceiver的onReceive()无法接收到另一个BroadcastReceiver发送的广播 - BroadcastReceiver's onReceive() is failing to receive the broadcast sent by another BroadcastReceiver 无法从Intent中提取数据-Firebase推送通知 - Can't extract data from Intent - Firebase Push Notification BroadcastReceiver 的 onReceive 中的 Intent extras 为空 - Intent extras are empty in onReceive of BroadcastReceiver Android - BroadcastReceiver没有收到自定义意图 - Android - BroadcastReceiver doesn't receive custom intent 不调用来自BroadcastReceiver的onReceive - onReceive from BroadcastReceiver is not called BroadcastReceiver无法从正确的操作意图接收广播 - BroadcastReceiver not receive broadcast from correct action intent 扩展BroadcastReceiver onReceive函数无法从其他类获取静态ArrayList - extends BroadcastReceiver onReceive function Can't get static ArrayList from other class BroadcastReceiver无法接收该Intent - BroadcastReceiver is not able to receive the Intent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM