没有Google服务的Android推送通知

没有Google服务的Android推送通知

本文介绍了没有Google服务的Android推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自苹果世界,所以我没有太多的Android经验。不过,我所看到的是Android设备接收推送通知的方式,而不使用任何第三方服务器。通知需要是标准的Android通知(外观和感觉)

我需要这个的原因是,因为我需要在一个没有外部世界访问的房间。 (不能连接到任何服务器)但我有我自己的WiFi,所以用户可以通过我的无线接收来自我的服务器的推送通知。

我知道在iOS上这是不可能的,那么Android呢?

解决方案可以使用 Service 应用程序退出后。一些样本,您应该对 START_STICKY感兴趣 flag



您必须在<$ c $内保留一些连接(套接字?)或间隔请求(不太好,但可能) C>服务。 Google服务(包括Firebase)自行完成此操作,并重新传送接收到的推送消息,以正确声明(在清单中)应用程序中。

I am from Apple world, so I don't have much experience with 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)

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.

I know that on iOS this is not possible, what about Android?

解决方案

it is possible using Service left running in system (background) after app exit. some samples HERE, you should be interested in START_STICKY flag

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推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 19:04