[英]Handling Android Push notifications when app is not in the foreground using Delphi
My understanding is to receive the data from push notifications while the app is in the background or not running, one need a service which will put the data somewhere where the app can get at them when it starts up or goes to the foreground. 我的理解是在应用程序处于后台或未运行时从推送通知中接收数据,需要一种服务,该服务会将数据放置在应用程序启动或进入前台时可以到达的位置。 It appears that a common solution is to put the data into the app's Extras.
似乎常见的解决方案是将数据放入应用程序的Extras。
There are plenty of references for Java but my google-fu fails to find an implementation guide for Delphi. Java有很多参考资料,但是我的Google-fu无法找到Delphi的实施指南。
Also useful would be information on how to "Stack" the notifications into a single notification. 关于如何将通知“堆叠”为单个通知的信息也很有用。
I imagine one could write a single service which is triggered each time a notification arrives, and which then a) puts the data portion of the notification into the app's extras, and b) replaces the notification with a single stacked notification. 我想人们可以编写一个服务,该服务在每次到达通知时都会触发,然后将a)将通知的数据部分放入应用程序的附件中,然后b)用一个堆叠的通知替换该通知。
My question is "how does one write this service" - some template code would help, and tutorials or reference documents would be great. 我的问题是“如何编写此服务”-一些模板代码会有所帮助,并且教程或参考文档会很棒。
FWIW this is for an app with a chat like feature where one doesn't want any notifications to get lost. FWIW这是一款具有类似聊天功能的应用程序,该应用程序不希望任何通知丢失。
One thing at a time... here's a guide for implementing a service on Android . 一次一件事... 这是在Android上实现服务的指南 。
Full disclosure: I've no idea how effective or useful it is or how complete (or otherwise) Delphi capabilities for Android services are since I use Oxygene for Android development (also Object Pascal but works very differently than Delphi, enabling me to make use of all those Java references). 完全公开:我不知道它对Android服务的有效性或有用性,或德尔福功能的完善程度,因为我使用Oxygene进行Android开发(也是对象Pascal,但其工作原理与Delphi截然不同,这使我能够使用所有这些Java引用中)。
The rest of your question seems more related to specific business/application requirements than a programming/technical problem, but if you run into specific issues you should consider asking questions about those separately. 问题的其余部分似乎比编程/技术问题与特定的业务/应用程序要求更相关,但是,如果遇到特定的问题,则应考虑分别询问这些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.