Cordoba diagnostic plugin switchToLocationSettings ()

I am working on a cordova jquery mobile project.

I would like to know if it is possible to have a callback after running the switchToLocationSettings () function.

I would like to know if GPS has enabled on my device.

I use it as follows:

cordova.plugins.diagnostic.switchToLocationSettings();

but I would like something like this:

cordova.plugins.diagnostic.switchToLocationSettings(Success,Error);

Is it possible?

+4
source share
1 answer

According to Java Codefor this function no callback method. Check below -

    /**
 * Requests that the user enable the location in device settings.
 */
public void switchToLocationSettings() {
    Log.d(LOG_TAG, "Switch to Location Settings");
    Intent settingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    ctx.startActivity(settingsIntent);
}

That is why you cannot convey the superfluous callback functionin this method. You must write your own code.

0
source

All Articles