public void showAlertGPS() { if (!gps.isGPSActived()) { AlertDialog.Builder builder = new AlertDialog.Builder(SplashScreenActivity.this); builder.setTitle("Alert"); String message = ""; message = "Your GPS is turn off! Please turn on your GPS for the best location!"; builder .setMessage(message) .setCancelable(false) .setPositiveButton( "Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /*LoginManager.getInstance().logOut();*/ Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(intent, 1); } }) .setNegativeButton( "No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { toNextScreen(); } }); builder.create().show(); } else { toNextScreen(); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); /*//if (resultCode == 1) { switch (requestCode) { case 1: Log.e("test", "go to next screen here"); break; default: Log.e("test", "stay here"); break; } //}*/ if (!gps.isGPSActived()) { showAlertGPS(); } else { toNextScreen(); } }