Open Source • Background Tasks: Itoo 🚀

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

Hello,

I was wondering if someone might be able to help me. I've been trying to get the ChatGPT ChatBot to send me messages periodically (every 2 minutes, etc.), but I've come up trumps. This is my code:

I'm not sure why I'm unable to call the ChatBot as a procedure. Very new to this extension, so I apologise if the answer to this is obvious.

Any help would be much appreciated. I basically need this to run when the screen and/or app are closed.

Thanks in advance!

Converse is a method, not an event, therefore it makes no sense to register the Converse event

If you want to call the Converse method every 2 minutes, you need a clock component and register the Clock1.Timer event, set timer interval to 120000 and call the Converse method inside the timer event handler
Do you want to ask always the same question? Or where are the questions coming from?

Also register a Chatbot1.GotResponse event
And remember, global variables do not exist in the background

Taifun

Hi, it works to use createprocess and a timer and web component (every 10 seconds). With the store and fetch function, a word from the new response can be compared with the previous response. After restarting the tablet, the last response is still in memory, so it is stored in ROM. That's not necessary. Is there a better way than itoo.storeproperty and fetchproperty to temporarily remember the response from web.get? Possibly with local variables, but how do I go about that? Thanks, David.

Hi, while in Itoo, you may not use global variables (but you can use local variables tied to a procedure's scope). If you need an alternative to Store/Fetch property but while storing on RAM, then you may use this extension:

A reminder again: Memory space of background process is always parallel to that of main application. (They are not the same)

Thanks, I'll try that. This question occurred to me because with Arduino it is not recommended to overwrite the fixed memory every 10 seconds. I don't actually know whether this is also the case with an android tablet. David

Sorry but that variable extension does not seem to do the trick. In itoo the variable still is not remembered (null) on the next web.get. But I'll solve it another way. I'll make the website remember the previous value en put it in the published string together with the current value. Thanks for the reply anyway. Much success with this great itoo extension. David

1 Like

Thanks for your speedy response. The idea is for the chatbot to ask different questions every X minutes. This is what I have, but it doesn't work:

I got this to (partially) work another way using a store/fetch set up and a second clock, but that only worked when the app was still open (though screen closed). As soon as the app was closed, the same question would be asked, no new ones generated.

unfortunately you forgot to provide a screenshot, so we do not know what you were doing..
usually you use the StoreProperty/FetchProperty blocks to store values

Taifun

how do you generate new questions?
I only can see you asking always the same question...
unknown

Also I would register the event ChatBot1.GotResponse only once in your timer procedure and not each time the runTimer event handler gets triggered...

Taifun

Hi, the app works when I use store and fetch (left). But because I doubt whether it is good to write to ROM every 10 seconds, I wanted to find out if there is a way via RAM. When I try the extension suggested above (right) it doesn't work.
No sound is then played at all and 'null' continues to appear for that value in the label where the broadcast is normally shown.

Thanks again,
David

Heya @vhDavid,
you get a null because the first time, you have no data saved, so it returns you a null.

Before setting local variable vVoltage = Get(vVoltage),
you need to use this block before and check if the old value exists:

image