我有,只要它没有找到任何连接它打开了我的溅活动说:“没有网络连接” ......到现在为止一切都很好,但接收互联网connectivity..and广播接收器,当用户放使用设备主页按钮将应用程序拖放到背景中,然后关闭互联网连接,当应用程序在后台运行时,splash活动进入前台。我不想让这种情况发生,但是只能在后台打开。当应用程序在后台时,广播接收器在前台打开活动?
@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);
}
}
请发表您的广播接收器的代码。 – Erol 2012-07-11 05:48:42
我已经发布了它的最新资讯,PLZ – Ishant 2012-07-11 05:52:18