Notifications and background activity

thank you,sure I dont want everything, my code is ready , I just need the notification issues.
why do I need the clouddb here ? I dont understand what is its use here

I think , you miss understand the purpose of my application.
I have a sensor on arduino that senses the absence of electric power , so it sends me the data to a redis data base
on MIT app side , I read those values from the database , and sends a notification displaying those data according to a certain criteria.
everything is ready , but what i need now is to make this app sends notification even if the app is not working , even if the app is closed - I want to it to work in background even if it's killed by the user , so that it still sends notification all time

the latest screenshot you showed us was about CloudDB

so this is a CloudDB, isn't it?
your logic in the background is more or less "if CloudDB.DataChanged then send notification"... isn't it?

Taifun

2 Likes

I guess that is the purpose here? We can use CloudDB to listen to data changes and send a notification accordingly, what else do you want?

1 Like

There was some miscommunication, we believed you would want to achieve "sending notification when the app is closed through CloudDB".

Okay so, let me try to help you, how would you know when to send a notification to the user?

1 Like

I need , the app to send notifications even if the app is not working - like telegram for example it still sends us notifications even if its not working or even its not opened by the user.

Alright how do you know the time when to send a notification? It might help if you describe that to us.

I will make it more clear with an example :
i have data about electricity failure, true : means the electric power is available
false: means the electric power is not available.
I read those values from an online Redis Database
my app , reads those data , if the data is false for 10 minutes , using a timer , it must send a notification for the user " Electric Power is not available since 10 minutes"
then , if it stills not available more , it sends notification every 5 minutes
I can send the blocks if you want me to
Your help is really appreciated thank you

1 Like

Alright, so it looks like you are constantly checking the Redis database to know when there is a power outage?

How do you read the data? Can you share those blocks with us?
I'll help you write some basic logics and you'll do the rest.

Yes that's true
here are the blocks

Well, you are using CloudDB to check when there's a power outage?

Then why not check the earlier example posted that demonstrates how to use Cloud DB in background, from where you can check the database on a regular interval?


clouddb1.got value

I couldn't find how would that example helps me, sorry :smiley:

Sure, but thats why I posted the project file, why not build the AIA posted and see what happens? Oh does it run it background? Wow? :grin:

(make sure to change the CloudDB tokens, urls etc)

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