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
Post a Comment