Skip to content

Commit 9fd6713

Browse files
authored
chore: update example app (#227)
* chore: update example app * refactor: revert changes * fix: report end call with reason
1 parent 658c9d1 commit 9fd6713

File tree

7 files changed

+40
-23
lines changed

7 files changed

+40
-23
lines changed

example/android/app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88
<uses-permission android:name="android.permission.RECORD_AUDIO" />
99
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
1010
<uses-permission android:name="android.permission.WAKE_LOCK" />
11+
12+
<!-- Required for Android 13+ notification permission -->
13+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
14+
15+
<!-- https://developer.android.com/about/versions/14/changes/fgs-types-required -->
1116
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
1217
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
1318
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
1419
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
1520
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
21+
1622
<application
1723
android:name=".MainApplication"
1824
android:label="@string/app_name"
@@ -39,12 +45,12 @@
3945
/>
4046
<meta-data
4147
android:name="com.supersami.foregroundservice.notification_channel_description"
42-
android:value=""
48+
android:value="Description"
4349
/>
4450
<service android:name="com.supersami.foregroundservice.ForegroundService"
4551
android:foregroundServiceType="camera|microphone|mediaPlayback" />
46-
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask" />
47-
<service android:name="com.voximplant.foregroundservice.VIForegroundService" />
52+
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask"
53+
android:foregroundServiceType="camera|microphone|mediaPlayback" />
4854
</application>
4955

50-
</manifest>
56+
</manifest>

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@react-native-async-storage/async-storage": "^1.17.10",
1515
"@react-navigation/native": "^6.0.8",
1616
"@react-navigation/native-stack": "^6.5.0",
17-
"@supersami/rn-foreground-service": "^2.1.1",
17+
"@supersami/rn-foreground-service": "^2.2.5",
1818
"livekit-client": "^2.9.8",
1919
"react": "18.2.0",
2020
"react-native": "0.74.2",

example/patches/@supersami+rn-foreground-service+2.1.0.patch

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/src/RoomPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ interface RoomViewProps {
9595
const RoomView = ({ navigation, e2ee }: RoomViewProps) => {
9696
const [isCameraFrontFacing, setCameraFrontFacing] = useState(true);
9797
const room = useRoomContext();
98+
9899
useEffect(() => {
99100
let setup = async () => {
100101
if (e2ee) {

example/src/callservice/CallService.android.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ export async function startCallService() {
1010
importance: 'none',
1111
vibration: false,
1212
icon: 'ic_launcher',
13+
// @ts-ignore
14+
ServiceType: 'microphone',
1315
});
1416
}
17+
1518
export async function stopCallService() {
1619
await ReactNativeForegroundService.stop();
1720
}
1821

1922
export function setupCallService() {
20-
ReactNativeForegroundService.register();
23+
ReactNativeForegroundService.register({
24+
config: {
25+
alert: false,
26+
onServiceErrorCallBack: () => {
27+
console.error('Foreground service error occurred');
28+
},
29+
},
30+
});
2131
}

example/src/callservice/CallService.ios.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import RNCallKeep, {
44
AudioSessionCategoryOption,
55
AudioSessionMode,
6+
CONSTANTS as CK_CONSTANTS,
67
} from 'react-native-callkeep';
78

89
import { RTCAudioSession } from '@livekit/react-native-webrtc';
@@ -14,10 +15,21 @@ export async function startCallService() {
1415
let handle = '1234567';
1516
let contactIdentifier = 'Caller Contact';
1617
RNCallKeep.startCall(uuid, handle, contactIdentifier, 'number', true);
18+
19+
RNCallKeep.reportConnectingOutgoingCallWithUUID(uuid);
20+
21+
// Small delay to ensure proper state transition
22+
setTimeout(() => {
23+
RNCallKeep.reportConnectedOutgoingCallWithUUID(uuid);
24+
}, 100);
1725
}
1826

1927
export async function stopCallService() {
2028
RNCallKeep.endCall(uuid);
29+
RNCallKeep.reportEndCallWithUUID(
30+
uuid,
31+
CK_CONSTANTS.END_CALL_REASONS.REMOTE_ENDED
32+
);
2133
}
2234

2335
export function setupCallService() {

example/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,12 +2807,12 @@ __metadata:
28072807
languageName: node
28082808
linkType: hard
28092809

2810-
"@supersami/rn-foreground-service@npm:^2.1.1":
2811-
version: 2.1.1
2812-
resolution: "@supersami/rn-foreground-service@npm:2.1.1"
2810+
"@supersami/rn-foreground-service@npm:^2.2.5":
2811+
version: 2.2.5
2812+
resolution: "@supersami/rn-foreground-service@npm:2.2.5"
28132813
peerDependencies:
28142814
react-native: ">=0.59.0"
2815-
checksum: 733d9449e0e95566449306656a8465207bb45d6ecbc5cce9694a64779e4128677de06a5aa7a55e6cc7a929ad32de751cbf0e465ad8f663229705780cd1b7c161
2815+
checksum: a817ad18d722b977fd9e51f86af9ebae321c3533c8957ad9017562ab946ce1e6f6bbafe5b3cf5e0b4e0be01ffc0d191104b9013b892013a791b51a32c36f5210
28162816
languageName: node
28172817
linkType: hard
28182818

@@ -6134,7 +6134,7 @@ __metadata:
61346134
"@react-native/typescript-config": 0.74.84
61356135
"@react-navigation/native": ^6.0.8
61366136
"@react-navigation/native-stack": ^6.5.0
6137-
"@supersami/rn-foreground-service": ^2.1.1
6137+
"@supersami/rn-foreground-service": ^2.2.5
61386138
"@types/fastestsmallesttextencoderdecoder": ^1.0.0
61396139
"@types/react": ^18.2.6
61406140
babel-plugin-module-resolver: ^4.1.0

0 commit comments

Comments
 (0)