Notification Listener (powered by itoox-wrapper) and Itoo

May I know why 'after speaking' event is chosen (to register with itoo) instead of 'before speaking' or something similar to 'currently speaking'? Why future tense is preferred (To achieve what specific result)?

Update: I can guess the answer for this question as the project is aiming to play some music after the text notifications are converted to speech. But, when I use the app, I can hear only the voice of the text notifications and no music is played after that. So, still I'm in doubt.

Thankyou very much @Taifun for making this tutorial. This made me to complete my app.

you ony can register those events, which exist... the text to speech component offers the BeforeSpeaking and AfterSpeaking event, see also the documentation Media
As the example is designed, first the notification will be spoken and after that a short sound will be played, therefore the AfterSpeaking event was registered to play the sound.

it is a short sound of 1 second, actually the sound of a frog...
which device and Android version are you using for your tests?

For your purposes to play some music after a message arrived, you do not have to register the text to speech event... just play your music in the OnNotificationReceived procedure.

Taifun

1 Like

Thankyou

This app is not working when we close the app. But, working when we minimize it. The phone that I use is SM-A207F.

This is a Samsung A20? Which Android version?
Working fine for me on Samsung Galaxy A54 running Android 14
You might want to check Samsung | Don’t kill my app!
EDIT: disable batttery optimization, see also

Taifun

I noticed one thing. When we close the app and open it, we can see the quick shift of the message from ' Serivice is not running' to 'service is running'. So, it may mean that service is stop running while we close the app. But, I tested the older version of this app tutorial as well (that you posted before this one), it is working fine. Let me clarify again.

I screen recorded the video (You can see the quick shift of the message)

I tried the old version of this tutorial app once again. It can work even while we close the app. But, at beginning the app was not working, then I stopped the service and started again, after that it worked well.

The video for old version is in this link - WhatsApp Video 2024-01-23 at 20.49.29.mp4 - Google Drive

You lack some basic knowledge in App Inventor, I assume you do not know the Clock component in the demonstration.

I would recommend you to explore the resources posted above.

@Taifun , I am speaking about the app given in this tutorial post. I tried the old version that is posted one day before as well. That one is working (while the app is closed) in my phone but this one is not working in background. I shall upload that video as well.

Update: Yes, there may not be relationship between clock component & background processing. Okay, let me check.

@Kumaraswamy , yes, according to my life usecase, il learn the basics after taking my own time.

This is the video of the older version.

the example app checks in a Clock.Timer event, if the service is running
Unbenannt
and updates the text of label lblResult

Depending o the initial value of that label you see a quick flickering of that text


And as the initial text of version 2 is "service is NOT running", you see this quick flickering. Let me suggest you to change the initial value of that label to "Service is running" or just an empty text to see the difference.

If you have problems for the example app work in the background, then you should deactivate battery optimization as already mentioned earlier Notification Listener (powered by itoox-wrapper) and Itoo - #12 by Taifun

yes, first learning the basics would help you very much in being able to read and understand the blocks yourself

Taifun

1 Like

It works fine,
but if multiple notification received at same time, it doesn't read notification one by one, it skips to the latest,
tried with TinyDB but it works only when the app is open,

bg_notif_tinyDB.aia (103.7 KB)
Is it possible by any other methods?
@Taifun

Hi, can you please use the Store and Fetch property blocks offered by Itoo? Tiny DB does not always work properly in background.

But it too doesn't work in background, only works if the app is kept open

yes, and as far as I can see everything you need is already there...

  • as @Kumaraswamy already mentioned, use the StoreProperty/FetchProperty methods rather than TinyDB
  • also there is no AfterSpeaking event in the background, therefore we registered that event using Itoo to use the afterSpeaking event handler (which looks like a procedure)...
  • and you might want to register another event, the Player1.Completed event, to continue with the next notification after the sound has been played

what you have to do is the following (pseudocode)

in the OnNotificationReceived event :

  • receive a message and store it using the StoreProperty method
  • get all received messages using the FetchProperty method
  • if there is only 1 message, speak it

in the afterSpeaking event handler:

  • play the sound

in the completed event handler:

  • delete the first message
  • check, if there are further messages stored, if yes, get the first message and speak it

let us know about your progress...

Taifun

In the screenshot I shared, you spoke about the way to achieve something when there is no required event in the blocks.

Here, in this case you registered the event with itoo which looks like procedure. But, when we build some other app which doesn't need background processing, Can we create our own event/event-handler (which may look like procedure) when the required events are not available in blocks?

1 Like

you will need Itoo to be able to do this, so the answer is no

which event is not available?

Taifun

1 Like

A post was merged into an existing topic: Can we do this in an App created using Notification Listener?


About event also not registering

it doesn't support saving lists