How to get latitude and longitude

I need
when button 1 click
I get the latitude and longitude so I can store in database

Requirement ok, but have you tried anything so for? used any blocks? or default blocks? or any free api?

I tried location component but didn’t work

@Deathking can you show your blocks?

@Deathking Use this block


I tried but it don’t show the location when screen initialize
So I wait for half minute then I start moving around my house
now it show in label ( as it mention in block when location CHANGED )
But i want when user click on button i get location and they don’t have to do movement

1 Like

yes, the location sensor needs some time to get a satelite connection to be able to provide the first location data

use the Latitude and Longitude properties in the button click event…
from the documentation Sensors

The most recently available latitude value in degrees reported to 5 decimal places. If no value is available, 0 will be returned. Latitude is a value between 90 (north) and -90 (south), where 0 marks the Equator.
The most recent available longitude value in degrees reported to 5 decimal places. If no value is available, 0 will be returned. Longitude is a value between 180 (east) and -180 (west), where 0 marks the Prime Meridian.


1 Like

@Deathking Bro, You can use this block for store location in database but it is also take some time to get latitude and longitude…

@Jinx Bro, If we collect user latitude and longitude in database so which type permission we need to ask…
can you tell me all permission name which required for collect latitude and longitude.

And If we Publish this type app on play store then will we get any type of policy violation.

1 Like

it will be asked automatically for you (coarse and fine location)

I do not understand… you might want to elaborate…
of course you have to follow the Google rules and create a privacy policy for your app


1 Like

NO, it not about time, I tried it
it change text when i change my location ( move from one room to another )

its also same, it show 0 & 0 on start
when i start moving for 15 sec and click button then i got the location

@Deathking Bro, use notifier to get latitude and longitude in screen initialization to check, it’s working in same place without any move. It will take 5-10 sec for giving notifier alert. I have checked in companion not build apk.

1 Like

send me aia

I just build the app
when i start app in my home it not working, close the app remove from background
and open again outside my home ( distance not more than 15 feets )
it show location in approx 5 sec without any movement
Now the question arise, why it not work in my house ?

because, and this should be obvious, you are in the house without a good satelite connection

No @Taifun there is no satellite issue , that’s happening bcz of block :point_right: Location Changed :point_left: @Deathking try with html or php you will get instant location.