Search code examples
windows-phone-8windows-phone-8-emulator

Co-ordinates on wp8 emulator


I am trying to get my current location; my code is correct but wp8 emulator is giving every time same results (Microsoft place while I am in Asia). I also read people posts even on stack overflow but I could not understand their answer. they are saying set location from emulator ">>" "Location". I want to know can emulator give me correct answer when I run my app ? Is it emulator fault ? how will it work on real device ? will it give same wrong results or correct ones ?

Thanks


Solution

  • The WP8 emulator doesn't have a GPS or other means to get a location like a phone or other devices might be able to. So, the emulator has other ways of getting location information.

    If you want to change your location settings around, you need to click on the double chevron to the right of the emulator. This will open up the additional tools menu. Click on the Location tab. Then, click anywhere on the map to set your emulator's location to the place where you clicked. When you run code to get the location it will reflect the new location.

    Windows Phone 8 Emulator with additional tools open

    Now you asked

    can emulator give me correct answer when I run my app

    The emulator does not know where it is, you set its location in the way described above. So, as long as you give it a location you deem correct then it will be correct.

    how will it work on real device

    On a real device there are multiple ways of obtaining the location. 1. GPS. 2. Location of cellular towers. 3. You could connect to a Wifi network (The location of some wifi connection points can be ascertained by the phone.) The phone will use one of these mechanisms to get the location.