Ezra Epriputra

unread,
May 14, 2019, 1:58:22 AM5/14/19
to MIT App Inventor Forum
Haii Team AI2 App Inventor...

Thanks berfore for reading my questiona...
lately i made some test with location...
i use emulator...and the longitude and latitude is work very nice...
but when i baking it into apps...the latitude and longitude always 0
i tried to enable location service on my mobile phone for that apps but still cant work...
i use Xiaomi mi 8

location.png

WhatsApp Image 2019-05-14 at 12.49.25.jpeg




Ghica

unread,
May 14, 2019, 7:57:15 AM5/14/19
to MIT App Inventor Forum
Next time you post blocks, please click with your right mouse button on an empty space and choose download blocks as image. Upload that image.
Then, you must make sure that location sensing is enabled on your phone and you must wait for it to become active. From the documentation:

In order to function, the component must have its Enabled property set to True, and the device must have location sensing enabled through wireless networks or GPS satellites (if outdoors).

Location information might not be immediately available when an app starts. You'll have to wait a short time for a location provider to be found and used, or wait for the OnLocationChanged event


Cheers, Ghica.

SteveJG

unread,
May 14, 2019, 10:07:29 AM5/14/19
to mitappinv...@googlegroups.com
The code you have in your  'procedure' is entirely incorrect.Ezra.  You are attempting to create a 'ringed fence' ... there are several issues, among them are the values you set for latitude/longitude.  Where are the decimal points?  The correct way to create a ringed fence is described hereIf you run into problems, return here and show us what you tried and you will get specific advice after you correct your procedure.   Also, please rename you Procedure, using the default will cause compiling issues...change it to MyProcedure or RingedFence or something.

Regards,
Steve  
Reply all
Reply to author
Forward
0 new messages