Maintain the activity of an application in the background

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

Hello

I have done some work but i have 6 lists (40 items each) needs to be used in background so i cannot go further.
Perhaphs can i use "store" and "fetch" to save my lists ?

Sincerelly

yes, StoreProperty and FetchProperty
get it first working with 1 list...

Taifun

Hello

This extension is fascinating but to my knowledge unfortunately not suited to my application which uses 3D gyroscopes and accelerometers at a frequency of 400 times per second for real-time calculations and using the device's storage to exchange variables instead of the RAM does not seem efficient to me, without a way to replace the global variables in RAM I would not be able to follow up.

Sincerelly

Indeed, we suggest people not to use glob@l variables since it causes confusion, and unnecessary complexity to deal with. Moreover many people confuse a lot.

If really that's necessary, I would suggest you to go ahead and use glob@l variables, if that suits you. But it isnt really recommended as per code style.

Storing data also takes some time, a few milliseconds, and I do not think you will be able to store data in that frequency in the foreground..

Taifun

Hello Kumaraswamy

Thank you, i will try using global variables.

Sincerelly

Hello Taifun

I dont store this datas, i make calculations and display in real time with them.
You are true, it is a problem to collect and operate 2800 variables per second and i cannot admiss lag, i also redoubt to damage the devices using app for hours using device's storage.

Sincerelly