Android Question Starter service loosing variables initialization?

FrankBerra

Active Member
Licensed User
Longtime User
Hi all,
i developed an application that seems working good almost on all devices, but an user has a lot of problems with it.
He sent me a screenshot with am error saying that a "Object should be initialized (Map)" but that the Map is initialized in Starter service.

I am wondering if there can be something that interfere with the normal lifecyle of the starter service, or if the starter service can be killed in background while the app is opened and in that case it loses all references to variables....or something else!
Any suggestions?

The variables in starter service are declared/initialized like this:
B4X:
Sub Process_Globals
Dim MappaEtichette As Map
End Sub

Sub Service_Create
MappaEtichette.Initialize
MappaEtichette = File.ReadMap(File.DirAssets, "etichette-it.txt")
End Sub

Thanks in advance!
 

ilan

Expert
Licensed User
Longtime User
A service is not an activity

It is. Anything that is processing in the background or in the forground is an activity.
It is a process. Activity is not only a ui class.

I am talking about anything that is processing. So a service could be killed by a 3rd party app and this will lead to a crash because the referance to the map is now gone.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…