简体   繁体   中英

Ionic : GPS is not detect sometimes

I have one issue on my app. I have used GPS for getting lat and lon some times when clicking function GPS not detected app. So it's need to restart application. After restarting application GPS detected correctly. using ionic native with cordova GPS method( @ionic-native/location-accuracy ). Do you have any idea please share with me.

Even when click function there is no GPS turn on screen too when this issue happening.

Please share the solution for above issue

You may have to place it in the correct lifecycle method. Where do you have the method to get gps?

it needs to be after the component has be initialized:

ionViewDidEnter(){
   getLocation();
}

or

ngAfterViewInit(){
   getLocation();
}

For me Even while I'm clicking manually this function not working

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM