Google Maps
i)Get Gps location (https://ionicframework.com/docs/native/geolocation/)
1)Install Plugins
a)ionic cordova plugin add cordova-plugin-geolocation
b)npm install --save @ionic-native/geolocation
2)Get Current Location Latitude and lagintude like below
this.geolocation.getCurrentPosition().then((resp) => {resp.coords.latitude; resp.coords.longitude;}).catch((error) => {console.log('Error getting location', error);});
3)Convert Geocode to Address
this.geocoder.geocode({'location': latlng }, function (results, status) {if (status == google.maps.GeocoderStatus.OK) {
var address = (results[0].formatted_address);console.log(results);(document.getElementById('Address')).value = address;}});
ii)Check Location Enable or not (https://ionicframework.com/docs/native/diagnostic/)
4)Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
a)ionic cordova plugin add cordova.plugins.diagnostic
b)npm install --save @ionic-native/diagnostic
5)Find location enabled or not by following function
cordova.plugins.diagnostic.isLocationEnabled(function(enabled){if (enabled != true) {}else{}