Open Source • Background Tasks: Itoo 🚀

please use my locationservice extension as described in the documentation App Inventor Extensions: Location Service | Pura Vida Apps
there is no need to additionally store data manually in TinyDB, because the extension will do this automatically

to see the data, use the namespace TaifunLocationService
Unbenannt2
see also the example projects

Taifun

I did that. I have 5 screens, put the Location extension on 1st screen and 5th, put TinyDB component on each screen, set Namespace for each as "TaifunLocationService", set tag on 5th screen and try to get this tag with Itoo extension (and Tags later). The tag just absent.

1 Like

before doing experiments together with the Itoo extension you first should make sure, that there is data in TinyDB available
use my extension as it is meant to be used and display the stored data in a label or a map (see the example projects)

if you got that running, create a simple example using only the Itoo extension to read something from TinyDB and display it in a notifier
EDIT: you will have to use the NotificationStyle extension to do that, a simple Notifier will not work... you can find some examples here in this thread...

Then continue with more advanced experiments

Taifun

UPD: Error appears even if Itoo extension the only one extension in the app.

This error appears when CreateProcess block is used. (As well when CreateTask). The new project, no any extensions. Other components - label, two buttons, notifier

Yes. Tag exists as well data. Seems, Itoo extension does not read data properly from TinyDB.

Did that:
blocks(2)

If starting this with any event from app - answer yes. If starting from Itoo - answer "no". Have no any idea how it possible. If I will get list of tags, Itoo procedure will show them. Will go kill myself....

Hi, Itoo uses a different mechanism to store and retrieve data, and you cannot access or set to a tiny db using Itoo. They are two different storage types.
The normal tiny db data cannot be always synced with the services.

So if you want to save data specifically and operate on them on the background, you have to use the Fetch and Store blocks respectively.

Also from newer Android versions, you cannot directly use location services in the background, it requires special things to be implemented... Taifun Location extension is one of the option

1 Like

As I understand, no any way to get location data from Taifun's extension by Itoo extension, right?
Do you have any idea, why my test application on the Appinventor platform crashes? I have removed blocks related with TinyDB - it crashes anyway.

What about providing a screenshot of your blocks?

Taifun

Previuos I put in this post:

Current are here:

Please, tell me, what about "for" loops and "if" conditions in the background procedures - should they work?

Add an argument "x" to the "procedure1"

1 Like

This is NOT an example, which uses ONLY the itoo extension to read something from TinyDB and send a notification

You are trying to take several steps at once rather than do it step by step as suggested

Taifun

As Kumaraswamy said, Itoo extension unable to read TinyDB, so I'm trying to do this in another way. If everything works out I will post it here as a solution.

So, as I promised, solution for combining Location Service Extension by Taifun and Itoo extension:

"location_service" - it's my tag, defined in this block:

In this manner I can get list of coordinates, which saved in this tag.
Actually, we can get any TinyDB tag with this solution, just need to define needed Namespace.

JSONToolsVersion4.aix
com.KIO4_GetTinyDB.aix

Thanks a lot to @Juan_Antonio, for unique extension.
Thanks a lot to @Kumaraswamy , for the background tasks!

UPD. 16.06.23. This solution does not work with Location Service Extension by Taifun to get current coordinates. But, it will work with TinyDB, you can get data which written before app going to background. Here the working solution how to get coordinates with Location Service by Taifun.

1 Like

@Kumaraswamy Can I create a process, using a Clock1.Timer trigger, to perform an API call and, based on the returned json, decide whether or not to display a notification?

1 Like

Yes, this sounds doable
Read the entire thread, try the examples, play around with the extension.. then put together some blocks for your task... and if you got stuck, post a screenshot of your relevant blocks

Taifun

3 Likes

Seems, it read the data only once when process created. After that, even with clock event it shows the same. Data is changed, but output - no...

This is probably caused because of Synchronization issues.

Since the Taifun Location Service writes data to the normal storage, this isnt regularly updated while retrieving it in the background.

Please, explain, how to kill the background process. I used the StopProcess method to stop. Notification of the process disappeared, but another notification, generated by Notification style extension continue to appear 1 per second (by Clock event). It continues some minutes after process stop. As I understand, it's a task, which can be killed by StopTask method. But how to define it's id?

I've solved this issue with another extension by @Juan_Antonio, KIO4_terminal.aix. It reads properly. I will edit my previous post about reading TinyDB.

1 Like

Could you please show me your blocks again?