Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Push Notification from device to other devices

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.

like image 288
Coolai Avatar asked Aug 09 '13 11:08

Coolai


People also ask

Can we send push notification from Android?

Iterable can send push notifications to iOS and Android devices. Push notifications display content such as text and images, and can alert users by playing a sound. Depending on a user's device settings, push notifications can appear even when an application is closed.


1 Answers

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.

like image 150
npace Avatar answered Oct 04 '22 04:10

npace