简体   繁体   中英

Wait for Geocoordinatewatcher finish before continue with execution

I am making a app that inserts the gps coordinates on a db and when i run on the emulator it runs fine but when i actually move to the WP itself its just records the 2 first digits,like it records -19 for latitude witch is too vague for what i need,i need at least 3 decimal places ,but if i put the coordinates to a text block it show up fine. What i think its happening its that the app is inserting before the gps finishes tracking the coordinates so i need to set it to where the app would wait until its finished to insert, but i don't know how to do it, i tried put a system.threading.thread.sleep but it just freeze the app.One more thing the method to insert on the database is a asynchronous method.

var watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
watcher.MovementThreshold = 0.5;

Setting the Accuracy to High and the MovementThreshold to 0.5 (event will be fired when someone moves 0.5 meters) should give you the most accurate results for tracking the position.

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