0

EDIT: This isn't related to activity lifecycles. I did have an issue beforehand with Note 3s where the power saver mode recycled any of my static variables. Since then I went through extreme measure to ensure everything is being saved, passed and restored properly.

My application has a somewhat unique login system in place. The user cannot log in (and open the main activity) until they have gotten the latest files from Server and can verify the login based on those files. The login is stored in preferences when they login and cleared when the log out. If the application is restarted, the login is cleared. All crash logging is done through ACRA.

EDIT: There has been two instances of a burst of crashes that aren't related to the life cycle of the application and are being thrown because of some of the files missing. The only way those activities are launched is from the Main Activity that is launched by a Login Screen (both verify and use the Configuration files to process a successful login and available options). It looks like the activities are being launched directly without any of the required files/variables in place (login, etc).

I am able to narrow down the IP to San Jose, CA. The Build information looks like the following:

BOARD=herring
BOOTLOADER=D720SPRLC1
BRAND=Android
CPU_ABI=armeabi-v7a
CPU_ABI2=armeabi
DEVICE=crespo4g
DISPLAY=full_crespo4g-eng 4.1.1 JRO03R eng.azhang.20141014.185122 test-keys
FINGERPRINT=Android/full_crespo4g/crespo4g:4.1.1/JRO03R/eng.azhang.20141014.185122:eng/test-keys
HARDWARE=herring
HOST=lima
ID=JRO03R
IS_DEBUGGABLE=true
MANUFACTURER=unknown
MODEL=Full Android on Crespo4G
PRODUCT=full_crespo4g
RADIO=D720SPRLF2 
SERIAL=3434F1EE0F3100EC
TAGS=test-keys
TIME=1413337943000
TYPE=eng
UNKNOWN=unknown
USER=azhang
VERSION.CODENAME=REL
VERSION.INCREMENTAL=eng.azhang.20141014.185122
VERSION.RELEASE=4.1.1
VERSION.RESOURCES_SDK_INT=16
VERSION.SDK=16
VERSION.SDK_INT=16

I'm not sure what to make of these reports. Should I be worried or has anyone seen something similar?

  • What does your app do when the user switches back to it after it's been in the background for a while? Are you correctly saving and restoring state? The system may re-initialise your app in some activity other than the launch activity, if that's where the user left it last time. – Graham Borland Nov 24 '14 at 15:56
  • Source code and logcat files would help. – nathansizemore Nov 24 '14 at 15:56
  • Unfortunately I cannot add source code and I don't have logcat files for those crashes. EDIT: The regular use doesn't have any crash reports of this nature. The regular users would also have a License file that I am attaching in the crash report. The reason it's odd is because it looks like the activities are called and created out of order. – user3334691 Nov 24 '14 at 16:09

1 Answers1

0

It sounds like you are not correctly save and restoring state when your app has gone into the background. So user's that have previously logged in and are now in the middle of application suddenly do not have the expected state when they are returned to your app after it has been put into the background.

See http://developer.android.com/training/basics/activity-lifecycle/recreating.html

William
  • 20,150
  • 8
  • 49
  • 91
  • I'm sorry if I'm not expressing myself correctly. This is the second time this has happened (first time about a month ago). It's always an odd device that doesn't make sense that seems to be running activities out of order. The odd characteristic in those crash reports is that it's past the login screen attempting to issue a ticket and the config file doesn't exist. To me it looks like starting the app from random activities. – user3334691 Nov 25 '14 at 20:22
  • I assume you have implemented your app in such a way that users cannot deep dive straight into these Activities. If that is so, then almost certainly what you are seeing are people that HAVE logged in, have been navigating around your app and have then switched task to do something else like take a phone call. THey have not exited your app, it has just gone into the background. When they start your app again, they start at the Activity they left at. But it is up to that Activity to store its state otherwise they may come back with no state, which is what I suspect your are seeing. – William Nov 25 '14 at 22:04
  • William, I have dealt with this issue before. I store all 'static' variables in preference files (I noticed that static variables gets recycled a lot by different programs), for class variables and I use the on save and restore methods. Those crash reports happened twice (once a month ago three times on an emulator) and now on a different device 26 times each 5 seconds apart. What makes me skeptical is that when issuing a ticket, you do a vehicle lookup. I have a crash for trying to open up IssueTicket activity and then 5 seconds later for VehicleLookup activity with the same exception. – user3334691 Nov 26 '14 at 14:40
  • Woah - you really shouldn't be using static variables, unless it is just cache information that you can happily refetch if it is null. – William Nov 26 '14 at 15:26
  • Yeah, I figured that out the hard way - static variables in both the application and activity get recycled very often. I switched from using static variables to using preferences for the login information. Well, if if you haven't seen crashes like those then I guess I'll keep my eyes open for now. – user3334691 Nov 26 '14 at 22:02