Maintain the activity of an application in the background

This is an argument x
Screenshot_20240311_171626_DuckDuckGo

Both run in the background, a process runs in foreground mode and needs to display a permanent notification
You might want to read post 1 of the itoo thread again

Itoo is for advanced developers who do not hesitate to follow the guidelines memtioned earlier and are ready to experiment a little bit

Taifun

Hello

Not so easy to understand for non english speaking and non advanced developers, i would not use app inventor if i was.

keeps the service alive throughout the session without interruptions.
a permanent notification will be displayed throughout the session from Oreo.

I would understood better : a permanent notification must be displayed throughout the session from Android 8.

Thanks

1 Like

Hi @Jeff_Nash, I'm sorry for the complexity caused.

I will take the initiative to rewrite the documentation in a easy to understand manner this month. Thanks for your feedback!

here is a test project for you, which does more or less what you were trying to do
after clicking button start you hear a voice saying "This is the beginning", the app will close and after 5 seconds the voice will say "This is the end"

jeff.aia (69.1 KB)

Taifun

Thank you Kumaraswamy and Taifun

As I would like to have your knowledge and your talent, I get nowhere and I have given up on pursuing it.
Here we go again.

Sincerely

Hello

Take a look at what i have done based on Taifun app.
App is running also in android home screen and android lock screen and both.
When redisplay app the label is up to date and that is very good.
I hope i can continue in this direction with my app.

Sincerelly

1 Like

great, that you continue experimenting!

this is because you never closed the app... you just move it to the back and it was still running... to close the app use the close application block...

to be on the safe side use the FetchProperty method to fetch label text in the Screen.Initialize event

Taifun

1 Like

Yes, this is i want to obtain, app still running in background.

Ok, but i dont know how to do

Sincerelly

what you want is to reliably have the app running in the background
if you only move the app to the back, it is still running but can be closed any time by the Android operating system in case more system resources are required. Also not everything is doable in this state.

Unbenannt
please also understand the purpose of the valueIfTagNotThere socket... in your case you use numbers, so that default value should be 0 and not the text zero
Unbenannt2

Taifun

Hello Taifun

Yes, is it possible to make the app running anycase ?

Yes, but I think that doesnt matter in this case.

Sincerelly

if you use itoo correctly, then yes
currently you use a clock running in the foreground and another clock in the background... that clock in the foreground might be stopped by Android if you move the app to the back...

see my new example how to do it correctly only in the background...

jeff2.aia (69.4 KB)

Taifun

Hello Taifun

Ok, thank you very much, i will try to implement that.
I guess i can create several processes, or not ?

Sincerelly

Hi, no you cannot create several process. You can simply merge them into one process and you'll be fine.


I've also rewritten the documentation for the extension, you can check it here:

Hello Kumaraswamy

Thank you very much, i study that very carefully.

Sincerely

1 Like

Hello

I have some doubts about the extension, i have already made some work using local variables and store/fetch property to transmit values, is it good practices ?
Speed of calculation is important for real time and i wonder if store/fetch property do not make some lag.
But now i have to manage some lists, labels, buttons and canvas with sprites and i wonder how to do.

Sincerely

what about providing a screenshot of your relevant blocks?

in the background there are no user interface components available like labels, buttons, canvases etc.

you can display that later again after your app comes back into the foreground

Taifun

Thank you Taifun

For example

it looks like you are not familiar with the mutator

https://appinventor.mit.edu/explore/ai2/support/concepts/mutators

Taifun

Hello Taifun

Thanks, as i said i never used local variables before and i didn't saw that, this will help me.
When i type "global" with ctrl+F, navigator reply more than one thousand occurancies.

Sincerelly