techtinkerer techtinkerer - 20 days ago 13
Android Question

Android client to client messaging without my own server for GCM

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 ?

Answer

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.