android - GCM communicate with others activites -


i'm using gcm event server, works fine i'd communicate others activities using class gcmintentservice

i have method receve messages

@override protected void onmessage(context context, intent intent) {      log.d("gcm", "recieved message"); // data intent , send notificaion bar generatenotification(context, intent); } 

i'd exemple send datas mainactivity can't find how find:

intent intent = new intent(getbasecontext(), signoutactivity.class); intent.putextra("extra_session_id", sessionid); startactivity(intent); 

but in case don't want start new activity want send datas running activity.

thanks

i find solution, @selalerer help

in first time init receiver:

    //receive events private class receiver extends broadcastreceiver {       @override      public void onreceive(context arg0, intent arg1) {          system.out.println("receive");      } } 

in oncreate add

intentfilter filter = new intentfilter("local"); this.registerreceiver(new receiver(), filter); 

to finish send message with

intent i=new intent(); i.setaction("local"); i.putextra("test","test"); sendbroadcast(i); 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -