Notifications and background activity

hey guys , I am making an application that shows on android panel a notification like whatsapp notifications - for example , and shows that notifications even if the screen is off , and I want my application to be working in background.
I've found this link that shows an extension

my problem is I tried so much , and I couldn't find out how to use this extension , or maybe I didn't get a notification.
Note: I am using android 13 , and I am using mit companion

1 Like

Hi, welcome, the extension does not support running on Companion app, try to build, install and run it.

1 Like

Kindly do you have a picture for a sample block
In the link there is an every second notification blocks sample, but in the extension events there is no call notification

The example uses itoo together with the modified notification style extension

Guidelines for using Itoo

  • First get your background functionality running in the foreground. Like this, you can find errors much easier. And as soon as you got it working in the foreground, then test it in the background.
  • Read the complete Itoo to leaarn how Itoo works and try the example projects, See also the battery checker tutorial and notification listener and itoo tutorial .
  • Do not use global variables while in the background, use local variables instead
  • Do not use any user-visible or UI components in the background
  • In the background, use the Itoo StoreProperty/FetchProperty methods rather than TinyDB. TinyDB relies on SharedPreferences which will not ensure data synchronization across background processes.

Taifun

1 Like

Thank you for your replies
I tried yesterday but i couldn't find how to achieve my work.
I am getting data from the redis database to my application, i just need to send the data collected from the database as a notification every 5 minutes, such that even when the application is not shown or even if the application is not started by the user.
Your help is so much appreciated

Show us a screenshot of what you tried considering the previously mentioned guidelines

Taifun


Hello , thanks for your reply
I am using these blocks , for test purposes only
what's happening here is just getting 2 notifications , one is "How are you" which is I don't need - it happens once only
and I got a notification every second "Important Note" - knowing that I have a timer of six seconds interval , also I am using it just for test purposes
I want this notification to happen under if condition.
notice that I am using ltoo1 and NotificationStyle1 extensions

this is the permanent notification which is required for forground tasks

the 1 second is the default timer interval of the clock
you forgot to set the timer interval in your clocks procedure to 6000

what kind of if condition?
add your logic into the timer procedure

Taifun

1 Like


I want for example , a checkbox , when checked to get a notification , even if the application is not opened - I want it to work in the background
I hope you get my idea
I really appreciate your help , many thanks

use the StoreProperty method to store the checkbox.checked state
and in your timer procedure add an if statement to check the checkbox.checked state using the FetchProperty method of itoo

Taifun


I did this , kindly checkout the blocks
I am getting the notification after 6 seconds correctly , It worked
but , I still need the application to work in the background , even if the user killed all application.
is that applicable ?

the Clock1.Timer event will not work in the background, you have use your background event handler which looks like a procedure, you correctly registered your timer procedure for this, see also my example for Jeff here Maintain the activity of an application in the background - #25 by Taifun
and just follow my suggestion

Taifun


I am sorry for too much questions , but I still couldn't find a solution
here is my main project block , notice the notifier show alert , I just want my app to work in background , and send a notification like whatsapp notifications , in the place where the notifier shows alert.

It helps to be clear about your requirements... you now showed us a screenshot using CloudDB...
Unfortunately itoo is currently not compatible with CloudDB... see also here

Taifun

so as I understand , an application that uses clouddb , can't work in the background ?

kindly check this extension
https://ullisroboterseite.de/android-AI2-KeepAlive-en.html
do you think this extension can achieve what I need in my application ?

I do not know, I'm not familiar with that extension... itoo is the most powerful extension concerning background functionality...

just experiment yourself and let us know what you find out...

See also @SteveJG 's comment and example here

Taifun

The new update now adds compatibility with CloudDB.

1 Like

kindly would you help me please here , I want my application to send notifications even if it's killed not working , like whatsapp for example , it sends notification even if the app is closed

SimpleItooCloudDB.aia (82.2 KB)

I cannot help you with everything totally making the app. But here's what that might help you start.