Notifications and background activity

Okay , heheh , thank you.
I will try it. as soon as possible and be back to you

1 Like

I am getting an error every 5 minutes
CloudDBError: java.net.UnknownHostException:Mathematics-free-db

protip: what about providing a screenshot of your relevant blocks?
Taifun

1 Like

sorry
here are


the blocks

procedure bgTimer must be registered in the main procedure
without doing that, how should triggering that procedure work?

see again @Kumaraswamy's example from here Open Source • Background Tasks: Itoo 🚀

Taifun

Hello Taifun,
I just wanted to understand some points.
as I read before from this link https://community.appinventor.mit.edu/t/open-source-background-tasks-itoo/55125
After reading this :
Background Service: A non-visible background work that can be scheduled using Itoo.

  • Runs silently without user noticing it.

as I understand , what I need is a background service
if yes , the code above you sent me , uses createprocess - which is used for a foreground service , while background service needs to use createtask

Yes, of course, everyone wants that...
How long and how often should your process run? The longer and the more often ir runs, the more likely that it will be killed by the operating system if you use background service

You ignored the other parts from the documentation

  1. Background Service: A non-visible background work that can be scheduled using Itoo.
  • Runs silently without user noticing it.
  • Vulnerable to being stopped by the system abruptly, can only run upto a few minutes in modern devices depending on the phone brand, OEM, OS installed, etc. (also see dontkillmyapp.com )
  1. Foreground Service: A user visible and recommended way to execute something in the background.
  • Itoo is primarily based on supporting this service.**
    .

Taifun

I have an application that reads data from the database(about power/electricity state) , and shows a notification if the electricity is down.
I can check for that every 1 minute or 2 at maximum. I don't know if this can be done
Whats your opinion Sir.?
Any advices.?

yes, this is very often... so use Foreground Service
Taifun

Okay, i will try it, do you have a simple example to use a foreground service to achieve my goal?

also i tried the above blocks , and still got the same error.
notice that I am building the project not using companion

What error?

That is error with your credential configuration.

I changed the info in the green box in the blocks image I attached, so I got another error:
"CloudDBError: javax.net.ssl.SSLException: Unable to parse TLS packet header"
I don't know how to solve it
another questions please , I still don't understand how this code/blocks, will help me

As I said earlier, your configuration is incorrect.

This should be full Cloud DB url, this is incorrect.

sorry I forgot to attach the blocks
here they are

Alright, does it work for you if you use the default credentials?

it worked with no errors while using default credentials.
with respect to my credentials , when I changed the property "Redis Server" to "DEFAULT" I got no error. but I see no change in the Redis Database data.
another questions please , I still don't understand how this code/blocks, will help me ?
I mean , what is the purpose of these blocks , supposing that they worked correctly

Every 5 seconds they store the text
Meow, Kumaraswamy!
in your database

Taifun