Save data to local dB at specific period without opening app

after testing Itoo extension made by @Xoma I tried to save data in my Tiny dB without notifying user while app closed. here is the step…
:hammer_and_wrench: Component List

  1. :timer_clock: Timer to count delay to start activity at the background.
  2. :play_button: Button one to start activity at the background
  3. :play_button: Button two to get the data saved after Itoo complete it’s activity at the background.
  4. :page_facing_up: Label to display what is in my Tiny dB after and before the activity.

:bullseye: Step one:: State function when button one click, at this time itoo will start at the back ground after a period state in latency end. set the restart to true if you want to restart the activity again.

while this button clicked the procedure named by myBackgroundProcedure will called.

:bullseye: Step Two: state function inside myBackgroundProcedure.

This function will call procedure called bgTimer after 10000 millisecond

:bullseye: Step three: then we will store any type of data without using varaiabl in a local dB. don’t use inbuilt Tiny db function .

it will store data 1234 to the local dB by creating tag tinydata

:bullseye: Step four: look what is in local db using button two and label

:hammer_and_wrench: Procedure to check working correctly
you can close the app after clicking button one to start activity also you can check what is in local db of tag tinydb by clicking button two you get 0. then after taking some delay stated in your function come back and open the app, then you can click button two to check if the data saved :tada: :tada: yeah it saved you will see 1234 on label.

this guide is for you if you don’t want to see notification on taskbar while background activity take place.

thanks :folded_hands:

2 Likes

Hi solomon,

Great guide, but I just wanted to point out that…

You’re creating a task, which means your process is vulnerable to being interrupted, just like Xoma explained.

3 Likes

Nice guide
Disadvantage is

And if you use CreateProcess then you have to display a persistent notification which can get dismissed by the user.

To get something done in the background without displaying a persistent notification you usually would use the alarmmanager

Link to my extension: App Inventor Extensions: Alarm Manager | Pura Vida Apps

Taifun

2 Likes