Soundariya-Bingu commented on issue #255:
URL: 
https://github.com/apache/cordova-plugin-geolocation/issues/255#issuecomment-1330433322

   > > I am using IONIC and change "cordova-plugin-geolocation" to 
@capacitor/geolocation it working
   > > ```
   > > //import { Geolocation } from '@ionic-native/geolocation/ngx';
   > > //import { LocationAccuracy } from '@ionic-native/location-accuracy/ngx';
   > > import { Geolocation,PositionOptions } from '@capacitor/geolocation';
   > > ...
   > > public options: PositionOptions = {
   > >     timeout: 5000, 
   > >     enableHighAccuracy: true, 
   > >     maximumAge: 3000
   > >   };
   > > ...
   > > 
   > > /*async getCurrentCoordinates() {
   > >     this.geolocation.getCurrentPosition(this.options).then((resp) => {
   > >       this.latitude = resp.coords.latitude;
   > >       this.longitude = resp.coords.longitude;
   > >       console.log('accuracy:',resp.coords.accuracy);
   > >      }).catch((error) => {
   > >        console.log('Error getting location', error);
   > >      });
   > >   }
   > > */
   > >   async getCurrentCoordinates() {
   > >     const position = await Geolocation.getCurrentPosition(this.options);
   > >     console.log('accuracy:',position.coords.accuracy);
   > >     this.latitude = position.coords.latitude;
   > >     this.longitude = position.coords.longitude;
   > >   }
   > > ```
   > 
   > You mean to say, to convert the ionic cordova project to ionic capacitor 
project ? I tried to add capacitor in my cordova project and it gives me error 
"SyntaxError: Unexpected token '('" in adb logcat.
   
   
   I used these links to install:
   
[https://www.npmjs.com/package/@capacitor/geolocation#getcurrentposition](url)
   [https://capacitorjs.com/docs/apis/geolocation](url)
   
   But getting this error in the console tab on the browser, I am using IONIC 5 
in my Mobile app
   Here is the error screenshot:
   
   
![Screenshot_2022-11-29_16-12-24](https://user-images.githubusercontent.com/71880675/204508566-13878748-37fd-4b2a-95f2-8c074f10715e.png)
   
   Please help somebody, I struck for 2 days I tried so many things but nothing 
is working as expected.


-- 
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