Tuesday, 15 March 2011

Automatic restart android mono app on crash -



Automatic restart android mono app on crash -

i have question regarding alternative automatically restart android based app if uncaught exception fired causing application quit. thought implementing request follows,

create pendingintent in oncreate function of mainlauncher. pendingintent point broadcastreceiver in case fire off mainlauncher activity restart app?

protected override void oncreate(bundle bundle) { base.oncreate(bundle); restartintent = pendingintent.getactivity(this, 0, new intent(this, typeof(abroadcastreceivermaybe)), 0); }

catch uncaught exceptions app. understanding perchance override function thread.setdefaultuncaughtexceptionhandler() in java implementation android. not quite sure how works in under xamarin framework

in uncaught exception override, create alarmmanager fire pendingintent step 1 after 4 seconds. forcefulness quit app using exit() function, 1 time again unsure of implementation under xamarin framework.

after 4 sec delay in step 3, broadcastreceiver notified. on receiving notice, fire mainlauncher activity restart app.

if there more suitable implementation task happy take onboard. forwards hearing soon.

you'd improve off handling errors mate. user if have buggy app on phone , every time crashes automatically restarts gonna become annoyance.

android mono monodroid

No comments:

Post a Comment