android - Static variable is reset to null after a while -
i'm creating first android app. based on gps tracking. android app sends latitude, longitude, , misc. info (device id, time etc.) server. device id stored in static variable in home activity, , service used send locations. after time (~25 min.) elapses, static variable set null. why happen, , how can fix it?
one more thing: app works in background, i.e. it's not built continuous use other apps.
a static
data member lives long process does. your process not run forever. use static
data member cache, real data persisted (database, sharedpreferences
, ordinary file, internet, whatever), can re-initialize data needed.
Comments
Post a Comment