mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-23 02:17:20 +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);
|
BackgroundService.ForceRefreshConnections(context);
|
||||||
break;
|
break;
|
||||||
case Intent.ACTION_SCREEN_ON:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.i("BroadcastReceiver", "Ignoring broadcast event: " + intent.getAction());
|
Log.i("BroadcastReceiver", "Ignoring broadcast event: " + intent.getAction());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user