Skip to content

Commit

Permalink
Merge pull request #769 from react-native-webrtc/stop_listening_phone…
Browse files Browse the repository at this point in the history
…_event_ended

Stop listening phone event ended
  • Loading branch information
manuquentin authored Apr 23, 2024
2 parents cc308ce + d34d704 commit 0eb9a5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ public void reportEndCallWithUUID(String uuid, int reason) {
return;
}
conn.reportDisconnect(reason);

this.stopListenToNativeCallsState();
}

@Override
Expand Down
28 changes: 16 additions & 12 deletions android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,22 @@ private void wakeUpApplication(String uuid, String number, String displayName) {
// Avoid to call wake up the app again in wakeUpAfterReachabilityTimeout.
this.currentConnectionRequest = null;

Intent headlessIntent = new Intent(
this.getApplicationContext(),
RNCallKeepBackgroundMessagingService.class
);
headlessIntent.putExtra("callUUID", uuid);
headlessIntent.putExtra("name", displayName);
headlessIntent.putExtra("handle", number);

ComponentName name = this.getApplicationContext().startService(headlessIntent);
if (name != null) {
Log.d(TAG, "[VoiceConnectionService] wakeUpApplication, acquiring lock for application:" + name);
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
try {
Intent headlessIntent = new Intent(
this.getApplicationContext(),
RNCallKeepBackgroundMessagingService.class
);
headlessIntent.putExtra("callUUID", uuid);
headlessIntent.putExtra("name", displayName);
headlessIntent.putExtra("handle", number);

ComponentName name = this.getApplicationContext().startService(headlessIntent);
if (name != null) {
Log.d(TAG, "[VoiceConnectionService] wakeUpApplication, acquiring lock for application:" + name);
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
}
} catch (Exception e) {
Log.w(TAG, "[VoiceConnectionService] wakeUpApplication, error" + e.toString());
}
}

Expand Down

0 comments on commit 0eb9a5f

Please sign in to comment.