diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 88e89565..4af21b2a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -8,11 +8,17 @@ + + + + + + - - + - + diff --git a/example/package.json b/example/package.json index c46bb798..f5a6529e 100644 --- a/example/package.json +++ b/example/package.json @@ -14,7 +14,7 @@ "@react-native-async-storage/async-storage": "^1.17.10", "@react-navigation/native": "^6.0.8", "@react-navigation/native-stack": "^6.5.0", - "@supersami/rn-foreground-service": "^2.1.1", + "@supersami/rn-foreground-service": "^2.2.5", "livekit-client": "^2.9.8", "react": "18.2.0", "react-native": "0.74.2", diff --git a/example/patches/@supersami+rn-foreground-service+2.1.0.patch b/example/patches/@supersami+rn-foreground-service+2.1.0.patch deleted file mode 100644 index a3592ddb..00000000 --- a/example/patches/@supersami+rn-foreground-service+2.1.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/node_modules/@supersami/rn-foreground-service/android/src/main/java/com/supersami/foregroundservice/NotificationHelper.java b/node_modules/@supersami/rn-foreground-service/android/src/main/java/com/supersami/foregroundservice/NotificationHelper.java -index afccd04..26dbded 100644 ---- a/node_modules/@supersami/rn-foreground-service/android/src/main/java/com/supersami/foregroundservice/NotificationHelper.java -+++ b/node_modules/@supersami/rn-foreground-service/android/src/main/java/com/supersami/foregroundservice/NotificationHelper.java -@@ -14,6 +14,7 @@ import android.os.Bundle; - import androidx.core.app.NotificationCompat; - import android.util.Log; - -+import com.facebook.react.R; - - // partially took ideas from: https://github.com/zo0r/react-native-push-notification/blob/master/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java - diff --git a/example/src/RoomPage.tsx b/example/src/RoomPage.tsx index 63781714..edebaadb 100644 --- a/example/src/RoomPage.tsx +++ b/example/src/RoomPage.tsx @@ -95,6 +95,7 @@ interface RoomViewProps { const RoomView = ({ navigation, e2ee }: RoomViewProps) => { const [isCameraFrontFacing, setCameraFrontFacing] = useState(true); const room = useRoomContext(); + useEffect(() => { let setup = async () => { if (e2ee) { diff --git a/example/src/callservice/CallService.android.ts b/example/src/callservice/CallService.android.ts index 0e0a4234..aef1eaaa 100644 --- a/example/src/callservice/CallService.android.ts +++ b/example/src/callservice/CallService.android.ts @@ -10,12 +10,22 @@ export async function startCallService() { importance: 'none', vibration: false, icon: 'ic_launcher', + // @ts-ignore + ServiceType: 'microphone', }); } + export async function stopCallService() { await ReactNativeForegroundService.stop(); } export function setupCallService() { - ReactNativeForegroundService.register(); + ReactNativeForegroundService.register({ + config: { + alert: false, + onServiceErrorCallBack: () => { + console.error('Foreground service error occurred'); + }, + }, + }); } diff --git a/example/src/callservice/CallService.ios.ts b/example/src/callservice/CallService.ios.ts index bc59ad59..610b3f5d 100644 --- a/example/src/callservice/CallService.ios.ts +++ b/example/src/callservice/CallService.ios.ts @@ -3,6 +3,7 @@ import RNCallKeep, { AudioSessionCategoryOption, AudioSessionMode, + CONSTANTS as CK_CONSTANTS, } from 'react-native-callkeep'; import { RTCAudioSession } from '@livekit/react-native-webrtc'; @@ -14,10 +15,21 @@ export async function startCallService() { let handle = '1234567'; let contactIdentifier = 'Caller Contact'; RNCallKeep.startCall(uuid, handle, contactIdentifier, 'number', true); + + RNCallKeep.reportConnectingOutgoingCallWithUUID(uuid); + + // Small delay to ensure proper state transition + setTimeout(() => { + RNCallKeep.reportConnectedOutgoingCallWithUUID(uuid); + }, 100); } export async function stopCallService() { RNCallKeep.endCall(uuid); + RNCallKeep.reportEndCallWithUUID( + uuid, + CK_CONSTANTS.END_CALL_REASONS.REMOTE_ENDED + ); } export function setupCallService() { diff --git a/example/yarn.lock b/example/yarn.lock index 9731bd23..12dd1378 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2807,12 +2807,12 @@ __metadata: languageName: node linkType: hard -"@supersami/rn-foreground-service@npm:^2.1.1": - version: 2.1.1 - resolution: "@supersami/rn-foreground-service@npm:2.1.1" +"@supersami/rn-foreground-service@npm:^2.2.5": + version: 2.2.5 + resolution: "@supersami/rn-foreground-service@npm:2.2.5" peerDependencies: react-native: ">=0.59.0" - checksum: 733d9449e0e95566449306656a8465207bb45d6ecbc5cce9694a64779e4128677de06a5aa7a55e6cc7a929ad32de751cbf0e465ad8f663229705780cd1b7c161 + checksum: a817ad18d722b977fd9e51f86af9ebae321c3533c8957ad9017562ab946ce1e6f6bbafe5b3cf5e0b4e0be01ffc0d191104b9013b892013a791b51a32c36f5210 languageName: node linkType: hard @@ -6134,7 +6134,7 @@ __metadata: "@react-native/typescript-config": 0.74.84 "@react-navigation/native": ^6.0.8 "@react-navigation/native-stack": ^6.5.0 - "@supersami/rn-foreground-service": ^2.1.1 + "@supersami/rn-foreground-service": ^2.2.5 "@types/fastestsmallesttextencoderdecoder": ^1.0.0 "@types/react": ^18.2.6 babel-plugin-module-resolver: ^4.1.0