当应用程序在后台运行时,无法处理推送通知,接收推送但未点击横幅或警报(Can't handle Push Notification when the app is running in Ba

编程入门 行业动态 更新时间:2024-10-28 06:27:04
当应用程序在后台运行时,无法处理推送通知,接收推送但未点击横幅或警报(Can't handle Push Notification when the app is running in Background, receives push but didn't click on the banner or alert)

我在我的应用程序中实现了推送通知。 我已经测试了iPod中的推送消息。 结果如下:

测试的场景:1。应用程序在前端运行,iPod未锁定 - [状态=没问题]

应用程序在前端运行,iPod锁定 - [状态=没问题]

应用程序在后台运行,iPod未锁定 - [status = FOUND PROBLEM]未保存在数据库中+没有警报(实际上没有获取任何事件处理程序)

应用程序在后台运行,iPod已锁定 - 状态=如果我立即打开应用程序没问题,但如果我等待2分钟,然后打开我的应用程序我没有收到消息!

应用程序未运行(不在后台+前端),iPod未锁定 - (FOUND PROBLEM)未保存在数据库中+无警报{我可以看到推送消息作为警报,但我不点击它,我的应用程序然后包含徽章图标,但如果我点击我的应用程序,我不会获得有关推送消息的任何信息}

应用程序未运行(不在后台+前端),iPod已锁定 - 如果我立即解锁手机没问题,但如果我等待2分钟,我就丢失了消息!

-------------------------------------------------- ----------------------------------------

如果我总结一下我的问题:我正在获取所有场景的推送通知,但如果我没有点击警报/横幅,我无法处理某些场景的通知! 出于特殊目的,我希望在所有方案中将消息保存在本地数据库中。

我在stackoverflow和其他网站上看到了很多链接,但我没有看到有人已经遇到的相同情况!

我的iPod iOS版本是:5.0

有人可以帮我解决这个问题吗?

I have implemented push notification in my application. I have tested the push message in my iPod. The result is as follows:

Scenario Tested: 1. Application Running in Front End, iPod not locked - [status = no problem ]

Application Running in Front End, iPod locked - [status = no problem ]

Application Running in Background, iPod not locked - [status = FOUND PROBLEM] not saved in database + no alert (actually not getting any event handler)

Application Running in Background, iPod locked - status = no problem if I open the app immediately, but if I wait for 2 mins, then open my app I don't get the message!

Application isn't Running (not in Background + Front End), iPod not locked - (FOUND PROBLEM) not saved in database + no alert {I can see push message as an alert, but I don't click it, my app then contain a badge icon, but if I click on my app, I don't get any information of my push message}

Application isn't Running(not in Background + Front End), iPod locked - no problem if I unlock the phone immediately, but If I wait for 2 mins, I lost the message!

------------------------------------------------------------------------------------------

If I summarize my problem: I am getting the push notification for all scenario, but I can't handle the notification for some scenario if I don't click on the alert/banner! I want to save the messages in my local database in all scenario for special purposes.

I have seen so many links in stackoverflow and other sites as well, but I didn't see the same scenario that someone already faced!

My iPods iOS version is: 5.0

Can anyone help me regarding this issue ?

最满意答案

我不确定如何把它放得更好但是:这就是应该如何工作的。

您不能依赖推送通知作为唯一的通信机制。 当您的应用程序启动时,您需要有一种从Web服务查询当前状态的方法。

通知的有效负载中的数据可以用作快捷方式或优化,但不能替代刷新机制。

I'm not really sure how better to put this but: that is how it's supposed to work.

You can't rely on the push notification being the only communication mechanism. When your app starts you need to have a way of querying for the current state from your webservice.

The data in the payload of the notification can be used as a shortcut or optimisation but not an alternative to a refresh mechanism.

更多推荐

本文发布于:2023-07-21 23:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1214881.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:横幅   警报   应用程序   但未   后台

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!