Open Source • Background Tasks: Itoo 🚀

No
see the large answer here

Taifun

I have an app that’s supposed to vibrate in a specific pattern. This works fine when the phone screen is on, but the vibration stops as soon as the screen turns off. I want the vibration to continue, regardless of whether the screen is on or off.

I thought the Itoo extension would help solve this issue. I created a foreground process, but the result is that the vibration runs continuously—even after I swipe the app closed. The only way to stop it is by uninstalling the app.

How can I automatically stop the Itoo process when the app is closed by swiping it away?

Generally use a button to close the app and in the button click event use the close application block together with Itoo.StopProcess method

Also you can experiment with the ActivityChanged event from the tools extension App Inventor Extensions: Tools | Pura Vida Apps like this

If state = stop
Then Itoo.StopProcess

Taifun

And the above works, even I close the app by swiping?

Test and let us know
If you have issues, show us a screenshot of your relevant blocks

Taifun

@Kumaraswamy How can i run multiplie Itoo in one screen?
As am adding more than one web and each web is calling a different itoo data


image

@mustafaalbasel , please use the correct topic, that is twice now I have moved your posts...

1 Like

You missed the extension update here!

1 Like

Hi, you can only run a single Itoo instance in the application. Multiple instances are not supported.

Use ony one bgTimer main procedure and register all events there

In your procedure bgGet only call Web2.Get and Web3.Get

Taifun

Got it.
Thanks.

Ugo.

A list of possible solutions for handling vibration problems related to screen state and foreground services:

  1. The first option is to go into the phone’s settings and increase the screen timeout or disable it entirely. But this isn’t ideal, because I’d have to constantly switch the setting back and forth every time I use the app — which is too much hassle.

  2. The second option is to import the Tools extension, and monitor the app’s state changes:
    If state = stop
    then call Itoo.StopProcess
    This successfully stops the process when the app is closed by swiping, because the state changes to stop. Unfortunately, the state also switches to stop when the screen turns off — so this method doesn't work for my intended use.

  3. Placing the StopProcess method behind a button click, would obviously work (though I haven’t tested it). The downside is that I’d have to remember to tap the button before closing the app, and I usually just swipe apps away instead.

  4. The fourth option is to import the Tools extension and use
    Call TaifunTools1.KeepScreenOn
    This works well for me. The only downside is that the screen stays on and the touch interface remains active, which might lead to accidental taps — but that’s acceptable in my case.

Thanks to @Taifun for quick reply and hint from the Tools extension.

1 Like

thanks so much, its working well with one bgtimer

one more thing please
How can i eliminate notifications for some users?
for example showing it to drivers not customers
image

Question for you How to detect, if your user is a driver or a customer?
Taifun

Dear @Kumaraswamy, many thanks for your advise !
I updated it (and, luckily, my app still works :rofl: :rofl: :rofl:).

Cheers.

EDIT: WOW ...but.... now the popup does not appear any longer ??? :face_with_hand_over_mouth: :face_with_hand_over_mouth: :face_with_hand_over_mouth:.
Your last version was already implementing such feature ?

1 Like

there is a position box being added in the account and can indicate it by fire base or tinyDB,
one is driver and one is customer

@Taifun I tried to use that block to eliminate it but didn't work
image

  1. Your screenshot is of bad quality
  2. I can't read your language
  3. Protip: add a Notifier ShowAlert block as test to indicate, if it is a driver or customer

Taifun

here is another screenshot
image