+ Activity informing when app was killed while copy notifications were on

This commit is contained in:
Philipp Crocoll 2014-05-25 05:54:02 +02:00
parent ffc735c02c
commit 3947d8b7a5
1 changed files with 46 additions and 0 deletions

View File

@ -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();
}
}
}