Retain Android Application info after crash -
i created custom application class keep global informations of app.
i need informations after application restarts crash. don't need store informations in disk because info user current session, if app crashed, should start user before crash.
i thought in 2 ways solve problem: 1-track variables changes , persist in sharedpreferences 2-always save in activity saveinstance , retain savedinstancebundle
the problem solution 1 overhead in every change. problem solution 2 need serialize every info.
do guys know other way solve problem? need store when app crashs , load after starting crash. in 2 scenarios.
i'm using following code track whenever app crashes, can show better crash screen user, , allows me send information crash server later debugging.
thread.setdefaultuncaughtexceptionhandler(new thread.uncaughtexceptionhandler() { @override public void uncaughtexception(thread thread, throwable ex) { //get information , save information } });
but warning, need set in every activity / service create 100% effective.
personally have 1 base class activities, , 1 services, , classes implement uncaughtexceptionhandler, can save alot of headeche , code copy-paste.
Comments
Post a Comment