{"id":107336,"date":"2022-10-31T07:00:00","date_gmt":"2022-10-31T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=107336"},"modified":"2022-10-30T19:42:17","modified_gmt":"2022-10-31T02:42:17","slug":"20221031-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20221031-00\/?p=107336","title":{"rendered":"How can I test my geolocation code on a system without a GPS?"},"content":{"rendered":"<p>After you put your Windows system into Developer Mode, you have the opportunity to turn on the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/uwp\/debug-test-perf\/device-portal\"> Windows Device Portal<\/a> Web server.<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/uwp\/debug-test-perf\/device-portal-api-core\"> The Windows Device Portal REST API<\/a> gives you a way to control various parts of the system remotely. And the one that&#8217;s interesting for today&#8217;s topic is the REST API for <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/uwp\/debug-test-perf\/device-portal-api-core#location\"> injecting artificial GPS data<\/a>. After sending the REST command to enable GPS overrides, you can use subsequent REST commands to inject a specific latitude and longitude into the system&#8217;s geolocator.<\/p>\n<p>Now you can test geolocation on your development machine without having to drag it on a cart around the building. On the other hand, it also means you lost one justification for needing to take a trip to a tropical island &#8220;to test that the program correctly detects a change in location to a tropical island.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use the Windows Device Portal to create a synthetic GPS.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-107336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>You can use the Windows Device Portal to create a synthetic GPS.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/107336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=107336"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/107336\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=107336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=107336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=107336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}