Posts

Showing posts from August, 2016

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" ));