Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova diagnostic plugin switchToLocationSettings()

I work on a cordova jquery mobile project.

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

i would like to know if the user have enabled GPS on his device.

i use it like this:

cordova.plugins.diagnostic.switchToLocationSettings();

but i would like something like this:

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

is it possible?

like image 980
Malakiof Avatar asked Nov 10 '22 09:11

Malakiof


1 Answers

According to Java Code, there is no callback method for this function. 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's why you are not able to pass any extra callback function in this method. You have to write your own code.

like image 187
Gaurav Vachhani Avatar answered Nov 15 '22 05:11

Gaurav Vachhani