Open Source • Background Tasks: Itoo 🚀

Hi Kumaraswamy, I wasn't sure where to post that. If I do it this way it works. I suspect that's why the web.get stopped at if voltage > vVoltage and therefore never did the init variable.

When I stop and re-start the app the variable exist so it stays in memory, but after restart of the tablet gets re-init to 0, so it must be in ram somewhere... I hope :slight_smile:

Now I can try to intgegrate this in the existing app to keep that process running. Thanks all for the help.
David

1 Like

I have a question about the handling of notification messages.
When a foreground service is launched by Itoo CreateProcess function, a permanent notification message is displayed, having content defined by title and subtitle.
Is it possible to change title and subtitle of this notification message after having launched the service and while it is already in execution?
I made a trial using NotificationStyle extension to submit a notification message in order to display an information that is periodically updated by a Clock component in my app. It works fine, but I would like to avoid to have two notification messages, one from Itoo process and the other from NotificationStyle extension. Besides, each time I am going to update NotificationStyle notification message, notification incoming sound triggers continuously and it is quite annoying (I suppose it may be disabled in Android settings).
In other words, is it possible to change the text of title and/or subtitle of Itoo notification? Or, is it possible to change the text of an existing NotificationStyle notification message without triggering a new notification incoming?
I hope I have explained clearly my issue.
Thanks anybody in advance.

yes

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

Taifun

1 Like

Following to the received suggestions, I eventually succeeded in building a working app.
I believe worthwhile to post my example app about a basic usage of Itoo and MelonNotification, that I am going to exploit for another real project and that I hope could turn out to be useful for somebody else.

ItooProjectExample.aia (154.5 KB)

Any comment is welcome.
Thank you, Taifun and Kumaraswamy!

1 Like

To stop the service you could just call Itoo1.StopService in the StopButton.Click event without using a broadcast

Also you do not need this

the MelonNotification.AskPermission methoid is already doing it

Taifun

1 Like

Hello Taifun, thank you for the advices.
Actually, to stop the service, I followed the guidelines and recommendations of background music player showcase project (Detailed guide for creating a background music player with #Itoo).

In your case, you can simply directly call StopService in the StopButton click.

1 Like

Hello, it works as it should... on the Samsung tablet. However, on the Motorola device itoo does not close down completely.

Going to the setup screen I use 'StopProcess'. Afer coming back 'ProcessRunning' even notices itoo is not running
anymore it starts again after loading the new settings.
But, after that, on the Motorola device the timer (starts web.get) does that twice in the normal time, while broadcasting the interval shows the correct time.
When I go to setup again and come back the timers fires 3 times in that time.
Again... everything runs perfectly on the Samsung device.

A reboot of the device or reinstall of the app is necessary to get the proper timing again. Is that a known bug with Motorola (or even more brands)?
Any tips to prevent that from happening?

A picture with the most important blocks. And also the aia.

Thanks,
David


p1_Monitor.aia (600.0 KB)

Hi, I'm on break due to my exams until Feb 24.

Hello, good luck with your exam!

If anyone else wants to test too... this much simpler example replicates the error: Every time after stopping and starting itoo the counter is incremented 1x extra every 5s. The Motorola device runs on Android 14. The Samsung tablet where the problem does not occur runs on Android 10.


itoo_test_1.aia (108.2 KB)

Hello,
Thank you for your suggestions, here below my example app sorted out accordingly:

Unfortunately, even though I set MelonNotification AlertOnce property to true, each time I am going to update the notification message in the Clock Timer event, notification alert sound keeps triggering and it is quite annoying.
How can I make the notification silent or, at least, make it trigger the alert only the first time?
Thank you all.

try to set it in the BackgroundClock event handler
Taifun

1 Like

If you're working with background processes, this guide lays out the essentials really well! Running tasks smoothly while an app isn't active can be tricky, but frameworks like this make it easier. Also, for those managing projects and resources, having the right tools to store and organize data efficiently is key! :rocket:

Hello @vhDavid

After restarting the Itoo process (using StopProcess and then CreateProcess) you are telling me that every 5 secs the count is updated twice?

Could you please post an example (a quick screen recording)?

Yes that's right. But in my case that is not a problem, because I turn off my mobile phone every evening. Your exam is much more important. Here is the screen recording.

I had some pretty interesting results on my Android 14 as well, the behavior of services seems to have changed.

I observed that when you stop a service, then restart it, the service then does not begin with a new memory, it rather reuses old stuff.... I will work on this when I have some time. Thank you for the report.

Had some time this evening :grin:

I am trying Itoo for the first time and I am unable to get it working. I am testing the sample project "PropertyCatcher" and there is a runtime error.


I am using the version 4.4 of the extension. Anyone can suggest how can get it working?
I tried testing it on Android phone by building the apk. The apk installs but then I get to see only a blank screen and the screen gets unresponsive. I have to close the app manually.

Itoo does not work in the companion app
Build your project and test usung the apk file

Which Android version are you using for your tests?
Does the accelerometer sensor work, if you try a simple example project in the foreground?

Example project: App Inventor Code Snippets | Pura Vida Apps

Taifun

I tested the accelerometer in foreground and it works.
I am using Android 14.

What exactly do you expect the example to do?
It does not much, see again the documentation

The above example demonstrates how properties Sensitivity and Minimum Interval for the Accelerometer Component is saved and reapplied in the background.

You probably like to do something else? What exactly?

Taifun