Android Push Notification from device to other devices
Asked Answered
P

1

6

I have been trying to learn android programming following Ravi Tamada's tutorials - AndroidHive for weeks now. I created an app that performs Create, Read, Update and Delete actions (CRUD). Similar to this .

Now, what I want in my app is to have another feature that whenever there is a new data created and/or updated in the database, the app sends notification to other android phones that have the same app.

I've researched and come across Google Cloud Messaging, which AndroidHive also have a tutorial for. The way I see it is that it is only the server that can send notification to devices and GCM cannot do: "Device to another Device" For instance, "Device creates data -> send to database -> GCM sends notifs to other devices". Correct me if I'm wrong.

So I've searched again and found that you can use Smack for Instant Messaging app. Similar to something that I want my app to accomplish. But I'm having trouble understanding and implementing Smack to Java and Android.

So what I want to know is:

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

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

Thank you.

Peursem answered 9/8, 2013 at 11:17 Comment(0)
M
3

Check out the official tutorial on the Android developers site:

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

You can just upstream a message to the Google cloud and it will be sent to other devices in the same notification group.

I'd suggest that you always start with the official tutorials first and then move on to third-party blogs, it's just easier that way.

Manage answered 9/8, 2013 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.