@Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { Log.d("Lockscreen", "starting"); if (AppSharedPreference.getInstance(context).getAdLockScreenVisibility() && AppSharedPreference.getInstance(context).getAlreadyVerified()) { Intent serviceIntent = new Intent(context, MyBaseActivity.class); serviceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(serviceIntent); } } }
@Override public void onReceive(Context context, Intent intent) { ConnectivityManager coManager = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE); if ((coManager.getNetworkInfo(coManager.TYPE_WIFI) != null && coManager.getNetworkInfo(coManager.TYPE_WIFI).isConnected()) || (coManager.getNetworkInfo(coManager.TYPE_MOBILE) != null && coManager.getNetworkInfo(coManager.TYPE_MOBILE).isConnected())) { if (AppSharedPreference.getInstance(context).getUserID() != null) { context.startService(new Intent(context, XMPPChatService.class)); context.startService(new Intent(context, GetTotalCredit.class)); } registerGCMInBackground(context); /*AppUtils.smsCallPrices(context);*/ AppSharedPreference.getInstance(context).setIsConnectedToInternet(true); } else { AppSharedPreference.getInstance(context).setIsConnectedToInternet(false); } }