secretmoo35 commented on issue #255:
URL: 
https://github.com/apache/cordova-plugin-geolocation/issues/255#issuecomment-1327115564

   i'am use this plugin 
https://github.com/Esri/cordova-plugin-advanced-geolocation.git work on ionic 
5(android only)
   
   1.`ionic cordova plugin add 
https://github.com/Esri/cordova-plugin-advanced-geolocation.git`
   
   2. declare AdvancedGeolocation `declare var AdvancedGeolocation: any;`
   
   ```
     public getCurrentPositionAndroid(): Promise<any> {
   
       return new Promise((resolve, reject) => {
   
           AdvancedGeolocation.start((success: any) => {
             try {
               var jsonObject = JSON.parse(success);
               console.log('Provider ' + JSON.stringify(jsonObject));
               switch (jsonObject.provider) {
                 case 'gps':
                   if (jsonObject.latitude != '0.0') {
                     resolve({ coords: { latitude: jsonObject.latitude, 
longitude: jsonObject.longitude } });
                   }
                   break;
                 case 'network':
                   if (jsonObject.latitude != '0.0') {
                     resolve({ coords: { latitude: jsonObject.latitude, 
longitude: jsonObject.longitude } });
                   }
                   break;
               }
             }
             catch (exc) {
               console.log('Invalid JSON: ' + exc);
             }
           },
             function (error) {
               reject({ latitude: null, longitude: null });
               console.log('ERROR! ' + JSON.stringify(error));
             },
             ////////////////////////////////////////////
             //
             // REQUIRED:
             // These are required Configuration options!
             // See API Reference for additional details.
             //
             ////////////////////////////////////////////
             {
               'minTime': 500,         // Min time interval between updates (ms)
               'minDistance': 1,       // Min distance between updates (meters)
               'noWarn': true,         // Native location provider warnings
               'providers': 'all',     // Return GPS, NETWORK and CELL locations
               'useCache': false,       // Return GPS and NETWORK cached 
locations
               'satelliteData': false, // Return of GPS satellite info
               'buffer': false,        // Buffer location data
               'bufferSize': 0,         // Max elements in buffer
               'signalStrength': false // Return cell signal strength data
             });
       });
   
     }
   
     stopGetCurrentPositionAndroid() {
         AdvancedGeolocation.stop();
     }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to