没有 Google 服务的 Android 推送通知 [英] Android push notification without Google service
问题描述
我来自 Apple 世界,所以我对 Android 没有太多经验.
I am from Apple world, so I don't have much experience with Android.
但我正在寻找一种无需使用任何第三方服务器即可让 Android 设备接收推送通知的方式.通知需要是标准的 Android 通知(外观和感觉)
But what I am looking is a way that Android devices receive push notification, without using any third party servers. Notification need to be standard Android notification (look and feel)
我需要这个的原因是,因为我需要在一个无法进入外部世界的房间里.(无法连接到任何服务器)但我有自己的 WiFi,因此用户可以通过我的 wifi 从我的服务器接收推送通知.
The reason I need this is, because I would need this in a room that does not have access to outer world. (can't connect to any server) But I have my own WiFi so users can receive push notification from my server via my wifi.
我知道在 iOS 上这是不可能的,那么 Android 呢?
I know that on iOS this is not possible, what about Android?
推荐答案
可以使用 Service
在应用程序退出后在系统(后台)中运行.一些示例这里,您应该对START_STICKY
感兴趣标志
it is possible using Service
left running in system (background) after app exit. some samples HERE, you should be interested in START_STICKY
flag
您必须在 Service
中保留一些连接(套接字?)或间隔请求(不太好,但可能).Google 服务(包括 Firebase)自行执行此操作并将收到的推送消息重新传送"到正确声明的(在清单中)应用
you have to keep some connection (socket?) or interval requesting (not so well, but possible) inside your Service
. Google Services (including Firebase) does that by itself and "redeliver" received push messages to properly declared (in manifest) app
这篇关于没有 Google 服务的 Android 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!