|
@@ -51,11 +51,20 @@ public class JitsiMeetOngoingConferenceService extends Service
|
51
|
51
|
intent.setAction(Action.START.getName());
|
52
|
52
|
|
53
|
53
|
ComponentName componentName;
|
54
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
55
|
|
- componentName = context.startForegroundService(intent);
|
56
|
|
- } else {
|
57
|
|
- componentName = context.startService(intent);
|
|
54
|
+
|
|
55
|
+ try {
|
|
56
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
57
|
+ componentName = context.startForegroundService(intent);
|
|
58
|
+ } else {
|
|
59
|
+ componentName = context.startService(intent);
|
|
60
|
+ }
|
|
61
|
+ } catch (RuntimeException e) {
|
|
62
|
+ // Avoid crashing due to ForegroundServiceStartNotAllowedException (API level 31).
|
|
63
|
+ // See: https://developer.android.com/guide/components/foreground-services#background-start-restrictions
|
|
64
|
+ JitsiMeetLogger.w(TAG + " Ongoing conference service not started", e);
|
|
65
|
+ return;
|
58
|
66
|
}
|
|
67
|
+
|
59
|
68
|
if (componentName == null) {
|
60
|
69
|
JitsiMeetLogger.w(TAG + " Ongoing conference service not started");
|
61
|
70
|
}
|