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

Oh, I didn't realize that's what that meant. Thanks for the information!

Hi Taifun.
First off, thank you so much for the work you have done on this project.

Secondly, I hope you might steer me in the right direction.
I seem to be starting the foreground service correctly, as the notification is showing in my top bar.
However, what i'm having trouble with specifically is the "web got text".
when i run the "get" block manually it works fine. But when I run it from the foreground service I can't seem to update anything on my firebase db.

Again thank you for your time :slight_smile:

Remove that block


The clock already is running to call FarmDataUpdate regularly

It looks like you think, that your event Web1.GotText event will get triggered also in the background, this is not the case

In Update_Timer you have to register additionally the Web1.GotText event and do what you want to do in the corresppnding event handler

To debug use the Notifier.LogTextInfo method and use logcat to read the log

Taifun

1 Like

thank you so much for that info my friend :slight_smile:
here is my updated blocks. (let me know if you need to see anything else)
but ignore the broadcast event one.

does this look right to you?
i still am not seeing any updates in the firebase db

This looks ok
Now use the Notifier.LogInfo method for debugging together with logcat
For example to display the response content from the Web event handler

Taifun

ok. as far as i can tell i have adb running. and im succesffully getting stuff from my device.

however. I'm not seeing the response from the web.get.
here is the block snip, does that look right? i saw you previously mentioned "logText", but i didn't see that method in the list. Feeling confused, cause i thought the Notifier didn't work when the app wasn't open?
I am also filtering the logcat like this: adb logcat *:E | grep actualPackageName
Screenshot_135

Edit:

i changed the "LogError" to "LogInfo". and Changed my filter from *E to *I.
But same result. Cannot seem to see my responseContent in the log viewer.

i also added a "logerror" and a "loginfo" with the dummy text "this is a test", to see if the issue was the responseContent being blank. But i got the same result

And to clarify. My firebase DB is still not clearing or updating the value. But i have confirmed that the correct values are being stored into the itoo properties.

:pray: im sorry for my ignorance, and thank you so much for your replies. You are honestly getting me really really close to a working project

Yes, sorry, it is called LogInfo
Remove the 2 Firebase blocks and test again

Check also the log for itoo errors

Taifun

1 Like

You the Goat my friend!
Thank you so much for helping :slight_smile:
I've got it working now

Please let us know what the issue was and provide a screenshot of the working solution

Taifun

sure thing :slight_smile:

the block has changed quite a bit, because i've been working on it since that last post.

but here is the current block:

I pretty much just did what you said. However, I never saw anything inside the adb console.
Instead, i pushed a few notifications with "MelonNotification" to see the output content as well as just "the fact that the timer was working" more or less :person_shrugging:

I hope this is explanation enough xD I'm a beginner as far as using the App Inventor. So I'm not sure that I documented really all the changes.

1 Like

Hi everyone,
I'm working on an app that connects my Android (Android 13) to an Arduino using an HM10 BLE module. Right now, the app works as expected while it's open, but I'm trying to improve it by keeping certain features running in the foreground (and maybe even in the background later).
What I ened help with:First, keeping Auto-Reconnect working in the foreground
I tried making it work in the foreground, but it doesn't. As I said, it works when the app is on the screen. I’m not sure which blocks I should be using, or if that is even possible. Second, I also want the app to display a notification with the received string when data is sent from the Arduino. Do I need another extension for this?

Thanks in advance!

So you said, auto reconnect works when the app is open. Isn't that identical to foreground or do you have another definition for foreground?

Are you using Bluetooth Classic?
To try something with itoo follow the description in the first post of this thread. Try some examples to get familiar with the extension and if you have specific questions show us a screenshot of your relevant blocks

Yes, let me recommend

See also some examples there

Taifun

I think I missunderstood the definition in the extension description. What I mean, is for example, if I lock my Andorid screen, after 10mins max, the device disconnects, or that if I go away of the device, it disconnects, and I would like it to reconnect automatically. I then understand that what I need is the reconnect blocks to be working also in background? I am using a HM10 BLE module, so not Bluetooth classic.

Thanks for the recommendation. WIth the Melon extension, I can receive push notifications, as long as my device is still connected, right? So, for example my Android is locked, and a string is received, so I can show in the lockscreen a notification that the device has sent data.

Thanks for your help

I'm not a BLE specialist, but here in this thread there are already a few BLE itoo projects

Yes you can

Taifun

Hey Taifun,

Me again.
I'm having an issue where, when my process is running in the foreground. I will close my app, and then attempt to reopen it; this causes the app to more or less just crash before fully opening, until i force close it.

Any idea off hand what could cause that? I can ofc provide ss of the blocks upon your request.

Thanks again,

ispankzombiez

Please elaborate

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

yup.

here is a ss of it.

hopefully its not to much :laughing:
i've been at it for a minute now.

here is the blocks for the related processes
Screenshot_137

this is where the foreground process is being started

the logic of the app is like this.

  1. hits login screen (screen 1)
  2. checks for profile (login info / remember me info)
  3. if present, logs in, moves to "main" screen (this screen)
  4. else, asks for register/login

your large screenshot is of bad quality, unfortunately I can't read it
waht I can see here is you could simplify a bit... also I would use the same tags for TinyDB and itoo to avoid errors...
unknown

use logcat to find out what's going on as mentioned earlier

Taifun