diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index 3a22506ae..b749a2012 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -494,11 +494,18 @@ namespace Bit.Droid.Services public bool AutofillAccessibilityServiceRunning() { - var activity = (MainActivity)CrossCurrentActivity.Current.Activity; - var manager = activity.GetSystemService(Context.ActivityService) as ActivityManager; - var services = manager.GetRunningServices(int.MaxValue); - return services.Any(s => s.Process.ToLowerInvariant().Contains("bitwarden") && - s.Service.ClassName.ToLowerInvariant().Contains("accessibilityservice")); + try + { + var activity = (MainActivity)CrossCurrentActivity.Current.Activity; + var manager = activity.GetSystemService(Context.ActivityService) as ActivityManager; + var services = manager.GetRunningServices(int.MaxValue); + return services.Any(s => s.Process.ToLowerInvariant().Contains("bitwarden") && + s.Service.ClassName.ToLowerInvariant().Contains("accessibilityservice")); + } + catch + { + return false; + } } public bool AutofillServiceEnabled()