Get Lattitude Longitude and My current location

Hello,

I want to get lat and long of my current location but I am not finding any solution can anyone please help…

You can get the Latitude and Longitdude with the “Map” component.

screenshot-docs.kodular.io-2021.02.18-09_45_56

You can also use the following blocks with the “Location Sensor” component:

https://docs.kodular.io/components/sensors/location-sensor/

Use the Location Sensor

I tried using location sensor but not working

You must ask for permission to use the location first.

Needed permissions:

    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_COARSE_LOCATION
    android.permission.ACCESS_MOCK_LOCATION
    android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
3 Likes

Thanks can you please share aia if possible

Sure, give me a second

No permission required, if they enable location service, immediatly you can get it by using google map which is inbuild in the kodular app

location.aia (2.1 KB)

Just use these two blocks to get lattitude and longitude

blocks(1) blocks

1 Like

Thanks I will try this

I will try this also

getlocationwhenGPSon.aia (2.0 KB)

This aia will give geo value immediatly but user need to enable GPS on but no need to ask any permission

2 Likes

not correct what if user does not move then the event will also not fire i prefer you the best use location sensor component or use the extension by @juananton1991

1 Like

Thanks for the aia

1 Like

It works well even if you are ideal in position or moving .
I have tested and still working fine in my school attendance app.

1 Like

this is not working values are coming as 0

You’ll have to wait a few seconds and refresh again as it says in the AIA

this worked thanks