android.intent.action.MAIN

get all background notification message on your current Activity


in your background service.java

Intent i = new Intent("android.intent.action.MAIN");
i.putExtra("isNet", true);
context.sendBroadcast(i);


in your Activity where you want data

declare-----
private BroadcastReceiver mReceiver;


try {
    this.unregisterReceiver(this.mReceiver);
} catch (Exception ex) {
}

mReceiver = new BroadcastReceiver() {

    @Override    public void onReceive(Context context, Intent intent) {

//-----------here you get data from intent
    }
};
this.registerReceiver(mReceiver, new IntentFilter("android.intent.action.MAIN"));

Comments

Post a Comment

Popular posts from this blog

Radio Button style

android wifi debugging without root android studio