How to enable GPS pragmatically when app is initialize

when i open my ionic app then if GPS is off how to enable GPS pragmatically without going on setting menu

Checking GPS is enabled or not

cordova.plugins.diagnostic.isGpsLocationEnabled(function(enabled){
console.log("GPS location is " + (enabled ? "enabled" : "disabled"));
 }, function(error){
console.error("The following error occurred: "+error);
}); 

If success, then use the following plugin to show a confirmation dialog
https://www.npmjs.com/package/cordova-plugin-request-location-accuracy