Note that there are some explanatory texts on larger screens.

plurals
  1. POStop an intent after a redirection to setting menu
    primarykey
    data
    text
    <p>I'm currently developing an app which uses GPS location on googleMaps view. I check if GPS feature is activated, and if not I redirect the user to the setting menu. </p> <ol> <li>If I click on Back button (by activating or not the GPS) I come back to my app - works fine </li> <li>If I click on Home button, and then relaunch my app, I am directly redirected to the GPS setting menu => my intent is still on.<br> The problem is that I do not know when kill this intent. </li> </ol> <p>Here is the incriminated part of my code: </p> <pre><code> Button btnLocateMe = (Button)findViewById(Rsendlocationinfo.id.locateme); btnLocateMe.setOnClickListener(new OnClickListener() { public void onClick(View v) { Context context = getApplicationContext(); objgps = (LocationManager)getSystemService(Context.LOCATION_SERVICE); //Check GPS configuration if ( !objgps.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { //Warn the user that its GPS is not activated Toast gpsActivationCheck = Toast.makeText(context, "GPS deactivated - Touch to open the GPS settings.", Toast.LENGTH_LONG); gpsActivationCheck.show(); //Open the GPS settings menu on the next onTouch event //by implementing directly the listener method - dirt manner mapView.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { //And here is my problem - How to kill this process startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0); return false; } }); } else { //Location acquisition. } </code></pre> <p>I tried some stopself(), finish(), in onStop(), onDestroy(), onPause()... It crashes or does not do anything... Could you please give me a hand ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload