更新时间:2022-10-15 14:14:43
您基本上必须以某种方式使用服务器。我认为 Firebase 对你而言是完美的。它有一个你可以使用的Android插件,它会在数据库中发生变化时基本上提醒你的应用程序。以下是功能的文档。请参阅此示例以获得实施。在你使用这个插件之前,你需要创建一个账户,而不是基本的账户是免费的。以下是说明。
I am doing a prototype that involves messaging between clients.
What I want to do - from MyApp on device1, able to send message to MyApp on device2. Device2 should receive this and show a notification.
I don't have my own application server to push notifications from GCM to GCM clients.Is this possible ? How to do it ?
What I investigated - PubNub, which has a trial license that seems to answer my need to send messages on a channel without needing a server.
This discussion at SO didn't help much.
sending client to client messages without server interaction
Can anyone suggest better ways ?
You basically have to use a server in one way or another. I think Firebase would be perfect for your purposes. It has an Android plugin you can use that will basically alert your app when something changes in the database. Here is the documentation for that feature. Take a look at this example for implementation. Before you can use the plugin, you need to create an account and whatnot (basic one is free). Here are the instructions.