0

I am doing chat messenger using GCM. And here is my question, how can I update UI without using broadcastreceiver, because I'm using GcmListenerService, according to GCM documentation

 @Override   public void onMessageReceived(String from, Bundle data) {
     String message = data.getString("message");
     Log.d(TAG, "From: " + from);
     Log.d(TAG, "Message: " + message);
     // Handle received message here.   }

I am receiving push notifications from my server, but I dont know how to handle received messages to update UI of my activity.

Rahul Tiwari
  • 6,851
  • 3
  • 49
  • 78
Taldakus
  • 705
  • 2
  • 8
  • 18
  • 1
    you are using the documentation so check the GCM example github repository for the broadcast part. If you actually want to learn how to broadcast messages then go look into numerous examples in stackoverflow. You can also use a library like EventBus to send objects easily between classes. – mthandr Aug 12 '15 at 13:14
  • 1
    I dont know why you want to avoid broadcast recievers. but for your case localbroadcast is best bet. [This question](http://stackoverflow.com/questions/8802157/how-to-use-localbroadcastmanager) explains local broadcast in detail – Rahul Tiwari Aug 12 '15 at 13:31

0 Answers0