Android Push notification from device to other devices

I’ve been trying to learn Android programming for several weeks after learning Ravi Tamada - AndroidHive . I created an application that performs Create, Read, Update, and Delete (CRUD) actions. Similar to this .

Now what I want in my application is another function, when all the information is created and / or updated in the database, the application sends notifications to other Android phones that have the same application .

I researched and stumbled upon Google Cloud Messaging, in which AndroidHive also has a tutorial. I see that only the server can send notifications to devices, and GCM cannot execute: “Device to another device” For example, “The device creates data → send to the database → GCM sends notifications to other devices”, Correct me if I am mistaken.

So, I searched again and found that you can use the Smack for Instant Messaging app. Similar to what I want my application to run. But it's hard for me to understand and implement Smack for Java and Android.

So what I want to know:

1.) Is it possible for GCM to listen on a device to check if the application has changed the database and sends a notification to other devices that there is a change in the database?

2.) Do you have links to articles on "noo-friendly" links on how to have a basic understanding and implementation of Smack in Java-Android?

Thanks.

+6
source share
1 answer

Check out the official guide on the Android developer site:

http://developer.android.com/google/gcm/notifications.html#upstream

You can simply send a message to the Google Cloud and it will be sent to other devices in the same notification group.

I would advise you first to start with the official guides, and then go to a third-party blog, it's just easier.

+3
source

Source: https://habr.com/ru/post/951390/


All Articles