Hi,
I have a question on the behaviours of activities and services. When I startup the program the first activity will be started and this start a services. The services starts it selfs every 5 minutes.
When the user clicks a new program. The activity moves to the background and can be killed by the OS. The service keep running (normaly) but this one can also be killed I suppose by the os. In my logging I will see the following:
Service destroy
Service create.
I assume that the OS have destroid the service for some reason. What will happen to my global vars in this situation?
I have a SQL variable in my Main activity and this will be initializid in the first start of the program. I use this var also in the service but I see when the Service is destroyed and restart I get an error that the SQL is not initialized.
What is the prefered way of working.... Do I need a SQL var seperatly on every activity and service? Or just on the service and the activities can use the var?
I am a kind of Lost here....
I have a question on the behaviours of activities and services. When I startup the program the first activity will be started and this start a services. The services starts it selfs every 5 minutes.
When the user clicks a new program. The activity moves to the background and can be killed by the OS. The service keep running (normaly) but this one can also be killed I suppose by the os. In my logging I will see the following:
Service destroy
Service create.
I assume that the OS have destroid the service for some reason. What will happen to my global vars in this situation?
I have a SQL variable in my Main activity and this will be initializid in the first start of the program. I use this var also in the service but I see when the Service is destroyed and restart I get an error that the SQL is not initialized.
What is the prefered way of working.... Do I need a SQL var seperatly on every activity and service? Or just on the service and the activities can use the var?
I am a kind of Lost here....