Ionic-2 app, let user enable/disable geo-location to app

I build an Ionic app (by version 2 of Angular and Ionic).

In my app I have setting page.

I want to have a checkbox to let user enable/disable his geo-location for this app.

What is the best way to do that?

You can use an Observer.
When the user use checkbox, you start watchin the geolocation, and update it every X seconds.
And when he doesn’t want to be geolocated anymore, you stop watching his geolocation.

// to start watching = Geolocation.watchPosition().subscribe(pos => {
  console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);

// to stop watching;

But doesn’t it save the last geo-location? I don’t think it is the best way to do it.
I want to cancel permission of this app to use user location.

You can probably fake it by saving this property in your phone.
But to stop it on the system level, i’m not sure ionic can do that or i’m not aware how to do that.

And no, it doesn’t save the las location, it’s you who save the last location, you just have to delete it.