android - Add the result of several broadcasts on a single activity -


in application have broadcastque receives pushs notifications in background, push open activity information request accepted, happens @ same moment reading request receive app open on top in new intent.

public class broadcastreceiveronesignal extends broadcastreceiver {   @override  public void onreceive(context context, intent intent) {  bundle extras = intent.getbundleextra("data"); try {     jsonobject customjson = new jsonobject(extras.getstring("custom"));     if(customjson.has("a")){          string id = customjson.getjsonobject("a").getstring(constants.id_corrida);          intent = new intent(context, activty.class);         i.putextra(constants.id, id);         i.addflags(intent.flag_activity_clear_top |intent.flag_activity_new_task);         context.startactivity(i);     } }catch (exception e){     e.printstacktrace(); }  }  } 

you can check if activity in foreground change it's content. if not, start activity.

you can acomplish using static boolean variable change it's value in activity's onresume , onpause methods.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -