I have 1 service about mqtt receiver. When application receive message from mqtt server, it will start newA activity. this newA activity work fine but the problem is if I started newA activity before i receive message, nothing gonna happen. I tried
private newA na;
public void MessageArrive {
na.onDestroy(); //on newA activity onDestroy() is contain finish();
Intent runs = new Intent(getBaseContext(), newA.class);
runs.putExtra("data", arrMsg);
runs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(runs);
}
but it’s not work.
have any idea?
thanks in advance.
try use boardcast and on receive to listen boardcast should solve this problem.