Get just states and cities on GPS sensor

Hello community,

I need get State and City when gps sensor enabled, on each text box, now i get complete address, but i need only state and city to get tags in firebase…

you have to extract state and city from the complete address then…
however this might be different for each country…

Taifun

Ok, it’s showing in a text box, maybe work if store value in firebase or tinydb and them extracte value with index number?

sorry, I don’t understand, what you are talking about
you might want to try something yourself and if you get stuck, post a screenshot of your relevant blocks…
Taifun

img2

OK, look above when i click in second button GPS sensor is enable and geting address and show in text box, city and state show but, i have no idea how i extract and split only city and state.

1 Like

so it looks like the address in the example looks like this

street name, city - state, postal code, country

you have to check, if the street name also might include a comma…
you also have to check, if the address always is provided like this to avoid errors to extract city and state…

one possibility to get city and state would be to use the split block from the text drawer to split at , to get a list, then use the select list item block to select the second item, wich is city - state
you now might want to split again by . to get a list of 2 items, the city and the state

Taifun

1 Like

Here is the exact extention that you finding


yt.DeepHost.Location_Tracker.aix (11.9 KB)

1 Like

thank you,
extension now added in the extensions directory App Inventor Extensions | Pura Vida Apps

Taifun

Wow,

Exactly, incridible, thanks msr79526!
Thanks Taifun to support me!

1 Like

Hello again,

I put new plugin, but when i call button to get location… nothing happens…
Need load gps sensor in enable mode too?

gps1 gps2

I don’t know because I didn’t create this extention. That was created by deephost

Deephost extension doesn’ work for me too. I tested it with same settings above.
But this is the way you could do it with standard Kodular components:

1 Like

Hope this might help you

2 Likes

Thanks, it’s worked!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.