diff --git a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceService.java b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceService.java index efee1d5427b7..25f59f279688 100644 --- a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceService.java +++ b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceService.java @@ -33,6 +33,7 @@ import org.jitsi.meet.sdk.log.JitsiMeetLogger; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Random; @@ -113,13 +114,14 @@ public boolean onRequestPermissionsResult(int i, String[] strings, int[] results if (permissionsArray.length > 0) { try { currentActivity.requestPermissions(permissionsArray, PERMISSIONS_REQUEST_CODE); + JitsiMeetLogger.w(TAG + " Requesting permissions: " + Arrays.toString(permissionsArray)); } catch (Exception e) { JitsiMeetLogger.e(e, "Error requesting permissions"); listener.onRequestPermissionsResult(PERMISSIONS_REQUEST_CODE, permissionsArray, new int[0]); } } else { doLaunch(context, currentActivity); - JitsiMeetLogger.w(TAG + " Service launched"); + JitsiMeetLogger.w(TAG + " No permissions needed, launching service"); } } @@ -131,11 +133,15 @@ public static void abort(Context context) { @Override public void onCreate() { super.onCreate(); + JitsiMeetLogger.w(TAG + " Building ongoing conference notification"); + Notification notification = RNOngoingNotification.buildOngoingConferenceNotification(this); if (notification == null) { stopSelf(); JitsiMeetLogger.w(TAG + " Couldn't start service, notification is null"); } else { + JitsiMeetLogger.w(TAG + " Starting service in foreground with notification"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE); } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) { diff --git a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java index 28ab23f0dc32..8423b291c4ba 100644 --- a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java +++ b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java @@ -35,7 +35,10 @@ class RNOngoingNotification { private static final String TAG = RNOngoingNotification.class.getSimpleName(); static void createOngoingConferenceNotificationChannel(Activity currentActivity) { + JitsiMeetLogger.w(TAG + " Checking Android version and activity context"); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + JitsiMeetLogger.w(TAG + " Android version is lower than Oreo, skipping notification channel creation"); return; } if (currentActivity == null) { @@ -50,7 +53,7 @@ static void createOngoingConferenceNotificationChannel(Activity currentActivity) = notificationManager.getNotificationChannel("OngoingConferenceChannel"); if (channel != null) { - // The channel was already created, no need to do it again. + JitsiMeetLogger.w(TAG + " Notification channel already exists"); return; } @@ -60,6 +63,7 @@ static void createOngoingConferenceNotificationChannel(Activity currentActivity) channel.setShowBadge(false); notificationManager.createNotificationChannel(channel); + JitsiMeetLogger.w(TAG + " Notification channel created successfully"); } static Notification buildOngoingConferenceNotification(Context context) { if (context == null) { @@ -67,6 +71,8 @@ static Notification buildOngoingConferenceNotification(Context context) { return null; } + JitsiMeetLogger.w(TAG + " Creating notification with context: " + context); + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "OngoingConferenceChannel"); builder