Forum Xamarin.Forms

Get User Current Latitude and Longitude without any packages.

BhautikBhautik Member ✭✭✭

Hi,
I am implementing app where I need user's current latitude and longitude but without using any packages. So is there any way to do that?

P.S.
I have already tried this package but it didn't work properly.

var position = await locator.GetPositionAsync();

Above line never return once it is called and I am testing on my physical device.

Answers

  • AndreiMisiukevich_AndreiMisiukevich_ USMember ✭✭✭✭✭

    Hi)
    Fork this repository and create your own package on existing base =) Or it would be better if you find bug, resolve it and make PR to existing one =)

  • BhautikBhautik Member ✭✭✭

    @AndreiMisiukevich_ said:
    Hi)
    Fork this repository and create your own package on existing base =) Or it would be better if you find bug, resolve it and make PR to existing one =)

    I have tried with existing one but I am not able to resolve it. I have two physical devices for one device it is working fine but for the second it is not working.

  • seanydaseanyda GBMember ✭✭✭✭✭
    edited August 2018

    You should fork the repository and debug the solution line by line to find the exact issue of your problem on that specific device. Once you hit the breakpoint/line of what is breaking or causing unexpected behaviour we can look into alternatives ways of handling and fixing the issue.

    If you want to find out how to get the LAT/LNG for a device, the source code is on GitHub for all the platforms
    https://github.com/jamesmontemagno/GeolocatorPlugin/tree/master/src/Geolocator.Plugin

  • LuisDavidDelaCruzLuisDavidDelaCruz Member ✭✭✭
    edited August 2018

    Hi, @Bhautik , I have a solution in my GitHub account, I used a Dependency Service to get Latitude and Longitude

    www.github.com/luisdaviddela/Geolocator.Forms

    Don't forget permissions in the info.plist file

    I hope be useful for you

  • BhautikBhautik Member ✭✭✭

    @LuisDavidDelaCruz said:
    Hi, @Bhautik , I have a solution in my GitHub account, I used a Dependency Service to get Latitude and Longitude

    www.github.com/luisdaviddela/Geolocator.Forms

    Don't forget permissions in the info.plist file

    I hope be useful for you

    Its working fine but it is not working for Motorola device.

Sign In or Register to comment.