I have a broadcast receiver which receives for internet connectivity..and as soon as it doesn't find any connection it opens up my splash activity saying "NO INTERNET CONNECTION"....till now everything is ok but when user put the application into background using device home button and then off the internet connection the splash activity comes to foreground while the app was running in background. I don't want this to happen the splash activity should open but in the background only.
@Override
public void onReceive(Context context, Intent intent) {
// SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean isNetworkDown = intent.getBooleanExtra(
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
if (isNetworkDown) {
Log.d(TAG, "onReceive: NOT connected, stopping UpdaterService");
Intent myintent=new Intent(context,NoConnectivity.class);
myintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myintent);
} else
{
Log.d(TAG, "onReceive: connected, starting UpdaterService");
NoConnectivity.h.sendEmptyMessage(0);
}
}