Open Source • Background Tasks: Itoo 🚀

Hi, you can try this extension of mine instead:

would we face any issues if we do have to use the UI components? sure we wont be able to see anything while the app is in the background, but if its running in foreground, the UI will be visible yk?

Hi, no, you cannot directly interact with the UI components. The Itoo service runs in parallel.

1 Like

hi,
how to let the app with itoo show notification when the mobile was locked ? i test the Itoo with firebase , now work only in unlock status , any solution ? thanks

In your device settings you probably do not alow to show notifications while thr device is locked?

For example on my Samsung device: Notifications- Lock Screen Notifications

Taifun

Taifun

thank you , i set the lock screen notification , but still can not show the notifications triggered by datachange event, how to resolve ? By the way , how to use the itoo block to work with multiple childtag in firebase when app user subscribe multiple childtag for their interesting

Taifun

I resolved the first , in my test mobile has two notifies cat one is ItooApple , another is Defaut channel need setting in default channel can resolve the problem

how would you do it in the foreground? Any screenshot of your blocks?
Taifun


Can we create this type of thing with itoo for continuous listening and answering using chatbot component in background

Taifun

Thank you , here is the blocks let the foreground work and listening the childtag's update from firebase

, but in itoo.executeinternalscript block i dont know how to build the value with a childtag list and monitoring multiple childtag's update in background

Try to put these blocks

into your main procedure show_notice and create an event handler for Firebase_Realtime_DB1_ChildChanged

Taifun


heres the logic:

  1. the app initialises
  2. connect button is pressed, and with listpicker, bluetooth device is connected to the phone which starts a process.
  3. i saw somewhere that i shouldnt start a bluetooth connection on foreground and then use it in the background, but start the connection in the bg itself if i want to use it there, so i started an event of clock1.timer that disconnects the device once, and then reconnects it while launching two other events .
    the problem is- itoo does launch the process named orionpax but i dont think itoo recognises and reacts to the registerevent blocks as i cant see the device being disconnected anyhow which is the first if statement in the clock block.
    what am i doing wrong and what can i do to mend it?
    (also, even without the alarm loop, it wasnt registering the bleconnect and blereceive blocks at all.)

You forgot to start the clock for background processing

Btw. What is the purpose of your background processing if the only thing you are doing is updating the user interface? Which means, only if your app is in the foreground something is happening (after you fixed the bug)

Taifun

...wait how does one do that? i thought clock1.timerenabled in the listpicker was the way to start the clock for bg processing. i didnt know there was a different way of starting the clock.

ah these set of blocks essentially are highlighted part of the bigger issue im facing with another app. im just using the ui components for now to check for bugs.

it works as it should without itoo this way

Start the clock in your main procedure orionpax
For debugging let me recommend logcat

Taifun

yes i did that, and now i have realised that itoo can NOT perform "call BluetoothLE1.Disconnect." somehow thats in the timer procedure.
i tried to create a loop where the timer disconnects the device but then it doesnt disconnect at all, thereby causing more issues in the latter parts of the blocks.
blocks (86)




using the same disconnect block in the button1 works as intended, but somehow when its under a procedure itoo is running, it doesnt seem to work.

update: i think the issue is im connecting the device on foreground and then using the disconnect in the background.

probably would need another small clock that runs in foreground itself that disconnects the device and starts the process i believe.

Do the Connect also in main procedure orionpax

Yes

Taifun

yes, i did that and connected the device in bg using itoo and ran the connected and byte received command and everything works as it should.
just a problem tho, i dont understand what this error means. it comes up when the the device is connected using connectwithmatchingname block in bg


here is the working blockline.
the "set charuuid.text to" block in the ui_bleconnect doesnt seem to work.
neither does the disconnect button work as "disconnect cant be called before you are connected, whereas my device indeed IS connected, and responds with a small vibration when bytes are received.

you should connect and disconnect in the background as already mentioned earlier

Taifun

Sure but even so, shouldn't reconnecting it again after getting the name, by running the timer procedure in the bg do the same?
I'll try what instruction you gave me with image for now.