[PAID] 📍 Location Service Extension

Description

This extension is able to run in the background while your app is closed and stores location data (latitude, longitude and optionally current datetime, altitude, accuracy, speed, current address and provider) in TinyDB.

Also a background web functionality is available which can be used to send the location data in the background to a web service of your choice using a web request. This could be used for example to store the location data in a MySQL database or to send an email after a location change was detected while the app is not running.
A notifier will be displayed while the location service is running in the background.

notification

The extension can be used for devices starting from Android 5 (API 21).
For details, example project and documentation see here App Inventor Extensions: Location Service | Pura Vida Apps

Available Blocks



In the example app you can define a tag for TinyDB to store the data for a trip before starting the service. Later or even while the service is still running you can choose one of the tags and display the coordinates in a map. I have chosen the line string component here in the example app.

Price

12 USD, Payment options see my webpage

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

15 Likes

Nice Extension @Taifun :heart_eyes: :+1:

2 Likes

Awesome extension!

Nice extension @Taifun

1 Like

Tested it on my Pixel 4a with Android 11. It is working as it should. Didn't get an email after location change. Installed IFTTT but that didn't make a difference.

Great extension :snowboarder:

Just got back from an 11 km run. Working great. :grin:

4 Likes

AppInventor is slowly getting into building background apps :smiley:

6 Likes

(added to new FAQ section)

3 Likes

Thank you everyone and thank you @Peter for your tests...

to get an email you only have to check the Email checkbox and enter a correct email address...

however you created a lot of location changed events in that 11 km run... depending on the time interval and distance interval you have chosen this probably could have been around 500-1000 location changed events? My guess therefore is, your email provider has identified that great amount of emails as spam and has blocked them therefore...

trying my best to push the limits into that direction...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

3 Likes

I did enter a valid email and checked the checkbox. Just tested it again like this morning with a very short trip and now it works. Good job @Taifun. I must have done something wrong i guess.

2 Likes

Hi, I am interested in buying your "locationservice" extension, but I would like to be sure that is something that suits my needs. Let me describe you what I need:

My app has a timer - when the timer starts, the location sensor stores its coordinates in tinyDB, every 30 seconds.

I used a timer and a location sensor and work fine, as long as the screen remains on. Every 30 seconds a new record is added into tinyDB.

If I turn off (or lock) the screen, the timer still works fine, but location sensor stops sending anything. I guess it is related on appinventor's lack of running on background.

I tried your extension (keepScreenOn), but with no results - the screen remains on, but still the location sensor refuses to send its coordinates every 30 seconds (bear in mind that if I keep screen on manually - without your extension - everything works fine).

What if I buy your locationservice extension? Do you think it will work according to my needs?

Another question - does it offer integration with appInventor build-in maps?

Thank you,

Konstantinos

1 Like

you should be able to use the extension for this... just grant the permissions after starting the app and start the service as soon as you like...

and you also should be able to do what you want just by using the KeepScreenOn method from the tools extension... however this will drain your battery faster...

you can easily use the stored coordinates and display them on the map... see the example app...
also while you app is up and running you can use the LocationChanged event of the extension to update your map

Taifun

1 Like

Can you please explain me why this doesn't work?
rec
When I press stop button the only thing you can see in the screen is an empty list [].

1 Like

you are tring to request location permission and at the same time start the service, this will not work

Are you planning to publish your app in Google Play? In this case you have to get your app approved for background location access, see also Q1 here https://puravidaapps.com/locationservice.php#q

Let me suggest you to request location permission in the Screen.Initialize event
also make sure to have GPS enabled before starting the service... the example project actually shows you how to do it...

The location service is running, if you get the notification
notification
Also make sure to go outside to get a good GPS signal...

also remember... valueIfTagNotThere should be in your case a create empty list block...

Unbenannt2
because if there is no data, the list from csv table block tries to convert the value from valueIfTagIsNotThere into a list... and this will fail for an empty text block ...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

another error is, you forgot to assign the correct namespace for TinyDB...
Unbenannt
the example project actually shows you how to do it...

Taifun

2 Likes

Thank you so much!
five stars for the extension, five stars for after-sale service!

3 Likes

Hi again!
I have a strange problem! LocationService works fine in a testing app, which has only one screen (Screen1) - the one with the LocationService blocks.
I re-create the entire screen (blocks and components - all are exactly the same) in an app with many different screens - bear in mind that now the LocationService screen IS NOT the Screen1.
Now LocationService refuses to start - I press the button and nothing works..
I tried to call RequestLocationPermission in the first screen (Screen1), still the same
None of the other screens has nothing to do with location sensors, gps etc...
What happens?

1 Like

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

So, the name of the screen is "te".


When the StartButton is pressed, "started" appears in the textBox, but not any notification in the notification area - also not any record of coordinates in db (you can not see that function here, but it is in my real app and it does not work!)
BUT, if I create a testing app with only Screen1 (and the code you see in the image) everything works fine.. "started" appears in the textBox and also you can see the notification

1 Like