Home > Net >  User's address/location to autofill in address entry field
User's address/location to autofill in address entry field

Time:11-16

Before,I want my output that it will autofill/complete the user's location/address in her/his address entry field, Assume user will tap the address entry field then his/her location will fill up. I tried to search in the internet about that thing but sadly, I cant find a solution. So I came up to a idea that, inside my address entry field I will put a image button then if user click it, it will open the map. Below is the code of my Runtest.xaml.csenter image description here

`

  async public void ImageButton_Clicked(object sender, EventArgs e)
        {
           
            await Navigation.PushAsync(new MapPage());
        }

`

What I expect to happen is upon clicking the icon inside the address entry field, It will open and map( I achieve it) but it must zoom to user's location like real time map? then after that user will see his/her location and maybe he/she can pin it, then the address will move or let say write into the address field. Anyone can help me ? Im new currently working our thesis, and Im newbie to xamarin cross platform. Any idea or links that are related to my problems, is highly appreciated :) No javascript pls but if your solution will include js then maybe I will to read it as I can.

Thank you.

CodePudding user response:

As Jason suggested, you can retrieve the device's current Latitude and Longitude by using Xamarin.Essentials: Geolocation and then use Reverse Geocoding to get the address based on the current Latitude and Longitude.

Here are some video links below that you can refer to it:

https://learn.microsoft.com/en-us/xamarin/essentials/geolocation?context=xamarin/android&tabs=android#related-video

https://learn.microsoft.com/en-us/xamarin/essentials/geocoding?context=xamarin/android&tabs=android#related-video

  • Related