Open Source β€’ Background Tasks: Itoo πŸš€

It is just a Screen1 event issue, since there's no actual Screen in background, the extension thus fails.

:ok_hand:
Thanks,
Randal

1 Like

Hey,
Question about the SaveProcessForBoot method

When called it would set the desired procedure to run each time the phone restarts or starts up, but after calling, would there be a way to negate the call? Stopping it from running at start up? And also would it continue running at start up until cache or data of the app is cleared by the user?

Currently not

It always will continue running at start up no matter of any clearings of cache or data

Taifun

Alright that's good to know, thanks a lot for informing me!

Hello all, I have two requests about this extension:

  • @Kumaraswamy: Is it possible to improve the extension and get rid of the usage limitation of the global variables? I would like to use the extension in my project including several global variables that is difficult to refactor, because I need to bring around some of them in different spots of my app to trace the status of the app and to drive its execution logic, so these variables are supposed to be visible everywhere.

  • Is it possible to modify the message displayed in the permanent notification? I would like to exploit the notification to show a message that changes according to the status of my app.

Thanks in advance.

Where exactly is the problem to use the StoreProperty/FetchProperty feature?
Example use Battery checker reminding you to unplug when fully charged

Taifun

Hello Taifun,
Thank you for your quick reply, your suggestion sounds very interesting and, I guess, the only feasible solution.
Here below the blocks of my app:

I believe it is worthwhile to explain a bit more of the history of my app.
The app was originally written to work in background mode by App Inventor Services. It worked like a charm, then App Inventor Services has been eventually shut down (App Inventor Services: this "services" service is obsolete - #5 by Salvatore_Oliva). However, I still have both aia project and apk files of my original app. Now I am in need to put my hands on the app to make it work on Android 15 (apk file is prevented from installing), but unfortunately I am no longer able to look at the blocks of my original app. I somehow succeeded in recreating and making the app run in foreground, now I would like to convert it to run in background by Itoo extension.
As you can figure, the modification involving global variables refactoring turns out to be quite heavy, since there are a lot of information getting around by them. On the other hand, as long as I acknowledge Itoo extension a very powerful and valuable project, caveat on global variables usage comes as a severe limitation.
I wonder if Kumaraswamy plans to modify and improve the extension in this sense. In the meanwhile, I will try to figure out how to modify my app as per your suggestion (it will be a lot of work!...).
Thank you again.

Use local variables where possible and use the StoreProperty/FetchProperty feature where not possible

And remember, in rhe background do not exist user interface components like labels and notifiers, use a notification instead

Taifun

Hi, I tell you to not use Global variables since its introduces another dimension of complexity to the application, which is often confusing and hard to debug for the users (and not worth the time). That's why we use Itoo's persistent storage method of Store/Fetch property.

In future, definitely improvements will be made in that direction, that's some time to wait.


Yes, you can use melon notification to post a new notification to the Id (123321) from the background procedure.

1 Like

Alright, that's good to know, thanks everybody a lot for the help! :slightly_smiling_face:

1 Like

Hi, @Taifun @Kumaraswamy. Is it possible to store sms in firebase using Itoo and TyfunTexting1 extensions? When i try to do that it doesn't work. Please, help!


ItooFirebaseDBSms.aia (91.0 KB)

The eventhandler for the AfterReading event must have the same arguments as the event

And register the event in bgFirebase procedure

However the question is, why storing the complete inbox every 5 seconds?

Taifun

Thanks, @Taifun. When I add inbox, sent and draft arguments its working correctly.

Hello @Free_Speech, it's nice that you got it working. Could you please also share your final blocks so others can benefit from it?

I only changed the bottom block, all other blocks are unchanged. Through these blocks, the complete messages of the phone will be stored in Firebase every five seconds. I am beginner in programming. It would be better if it was possible to store only the last message.
Screenshot 2025-01-26 091110

1 Like

@Kumaraswamy

With reference to this method:

Is it possible, with additional parameters, to specify which devices running the notification background service, receive the notification, or can it only be done for all ?

Hi, do you mean sending notifications to a specific device/user? If yes, you would need to generate unique UUIDs for each device. The service would then only listen to a particular firebase tag associated with its UUID.

1 Like

Thinking this through, the way I see it, is that the notification (which would contain a list of UUIDs, as well as the message) would be sent to all users, then filtered by the background task in the app to generate the notification for only those users whose UUID matches the ones in the list ? This would happen before the melonNotication is called in the notification procedure ?

1 Like

Thank you @Kumaraswamy

Got it working for the google sheets example:

1 Like