diff --git a/src/keepass2android/AppKilledInfo.cs b/src/keepass2android/AppKilledInfo.cs new file mode 100644 index 00000000..76e326e4 --- /dev/null +++ b/src/keepass2android/AppKilledInfo.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; + +namespace keepass2android +{ + [Activity(Label = AppNames.AppName)] + public class AppKilledInfo : Activity, IDialogInterfaceOnDismissListener + { + protected override void OnCreate(Bundle bundle) + { + base.OnCreate(bundle); + //as we expect this to happen only rarely (having a foreground service running when unlocked), + //we don't try to handle this better + //But at least explain to the user what happened! + ((NotificationManager)GetSystemService(Context.NotificationService)).CancelAll(); + AlertDialog.Builder b = new AlertDialog.Builder(this); + b.SetMessage(Resource.String.killed_by_os); + b.SetPositiveButton(Resource.String.ok, delegate + { + Intent i = new Intent(this, typeof(FileSelectActivity)); + i.AddFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask); + StartActivity(i); + + }); + b.SetNegativeButton(Resource.String.cancel, delegate { }); + b.SetTitle(AppNames.AppName); + b.SetOnDismissListener(this); + var dialog = b.Create(); + dialog.Show(); + } + + public void OnDismiss(IDialogInterface dialog) + { + Finish(); + } + } +} \ No newline at end of file