Android-Firebase Cloud Messaging设备到设备的推送通知,无需服务器

Android-Firebase Cloud Messaging设备到设备的推送通知,无需服务器

问题描述:

是否可以在没有服务器的情况下在2个android设备之间发送推送通知?

Is there a way to send push notification between 2 android devices without a server?

我找到了一些教程,但是所有教程都使用node.js发送通知.(或者我发现一些使用Firebase控制台执行此操作的示例)

I found some tutorials but all of them was using the node.js for sending a notification. (Or I found that some samples that were using the firebase console for doing this)

不是,

您需要一个服务器"来进行推送通知.正如您提到的,firebase是其中之一,您可以使用多种服务来做到这一点.您可能不需要完整的服务器,但是您需要某种服务才能做到这一点,您不能简单地立即在设备之间发送通知:

You need a "server" to do push notification. You can use a variety of services to do that, as you mentioned firebase is one of them. You may not need a full on server, but you need some kind of service to do that, you can't simply send notifications between devices straight away:

一些例子是:

AWS无服务器功能

firebase中的云函数

如果您想使用其中一项服务,则需要在应用中配置FCM,您可以在此处:)

If you'd rather use one of these services, then you'll need to configure FCM in your app, you can check how to do that in the docs. And some nice sample codes here :)