mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Fix ForegroundServiceStartNotAllowedException in ACTION_SCREEN_ON
The same way we did for ACTION_BOOT_COMPLETED
This commit is contained in:
parent
e9a862f27c
commit
b01266d654
@ -42,7 +42,12 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver {
|
||||
BackgroundService.ForceRefreshConnections(context);
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
BackgroundService.ForceRefreshConnections(context);
|
||||
try {
|
||||
BackgroundService.ForceRefreshConnections(context);
|
||||
} catch (IllegalStateException e) { // To catch ForegroundServiceStartNotAllowedException
|
||||
Log.w("BroadcastReceiver", "Couldn't start the foreground service.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.i("BroadcastReceiver", "Ignoring broadcast event: " + intent.getAction());
|
||||
|
Loading…
x
Reference in New Issue
Block a user