attempt to make OngoingNotificationsService compatible to Android 8 restrictions
This commit is contained in:
@@ -33,6 +33,7 @@ using KeePassLib.Keys;
|
||||
using KeePassLib.Serialization;
|
||||
using Android.Preferences;
|
||||
using Android.Support.V4.App;
|
||||
using Android.Support.V4.Content;
|
||||
#if !EXCLUDE_TWOFISH
|
||||
using TwofishCipher;
|
||||
#endif
|
||||
@@ -244,7 +245,7 @@ namespace keepass2android
|
||||
|
||||
public static void StartOnGoingService(Context ctx)
|
||||
{
|
||||
ctx.StartService(new Intent(ctx, typeof (OngoingNotificationsService)));
|
||||
ContextCompat.StartForegroundService(ctx, new Intent(ctx, typeof (OngoingNotificationsService)));
|
||||
}
|
||||
|
||||
public bool DatabaseIsUnlocked
|
||||
|
||||
@@ -65,11 +65,11 @@ namespace keepass2android
|
||||
// Set the icon to reflect the current state
|
||||
if (App.Kp2a.DatabaseIsUnlocked)
|
||||
{
|
||||
// Clear current foreground status and QuickUnlock icon
|
||||
StopForeground(true);
|
||||
// Clear QuickUnlock icon
|
||||
notificationManager.Cancel(QuickUnlockId);
|
||||
|
||||
//use foreground again to let the app not be killed too easily.
|
||||
StartForeground(UnlockedWarningId, GetUnlockedNotification());
|
||||
//use foreground again to let the app not be killed too easily.
|
||||
StartForeground(UnlockedWarningId, GetUnlockedNotification());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user