Skip to content

Commit 0eb9a5f

Browse files
authored
Merge pull request #769 from react-native-webrtc/stop_listening_phone_event_ended
Stop listening phone event ended
2 parents cc308ce + d34d704 commit 0eb9a5f

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ public void reportEndCallWithUUID(String uuid, int reason) {
718718
return;
719719
}
720720
conn.reportDisconnect(reason);
721+
722+
this.stopListenToNativeCallsState();
721723
}
722724

723725
@Override

android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,18 +382,22 @@ private void wakeUpApplication(String uuid, String number, String displayName) {
382382
// Avoid to call wake up the app again in wakeUpAfterReachabilityTimeout.
383383
this.currentConnectionRequest = null;
384384

385-
Intent headlessIntent = new Intent(
386-
this.getApplicationContext(),
387-
RNCallKeepBackgroundMessagingService.class
388-
);
389-
headlessIntent.putExtra("callUUID", uuid);
390-
headlessIntent.putExtra("name", displayName);
391-
headlessIntent.putExtra("handle", number);
392-
393-
ComponentName name = this.getApplicationContext().startService(headlessIntent);
394-
if (name != null) {
395-
Log.d(TAG, "[VoiceConnectionService] wakeUpApplication, acquiring lock for application:" + name);
396-
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
385+
try {
386+
Intent headlessIntent = new Intent(
387+
this.getApplicationContext(),
388+
RNCallKeepBackgroundMessagingService.class
389+
);
390+
headlessIntent.putExtra("callUUID", uuid);
391+
headlessIntent.putExtra("name", displayName);
392+
headlessIntent.putExtra("handle", number);
393+
394+
ComponentName name = this.getApplicationContext().startService(headlessIntent);
395+
if (name != null) {
396+
Log.d(TAG, "[VoiceConnectionService] wakeUpApplication, acquiring lock for application:" + name);
397+
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
398+
}
399+
} catch (Exception e) {
400+
Log.w(TAG, "[VoiceConnectionService] wakeUpApplication, error" + e.toString());
397401
}
398402
}
399403

0 commit comments

Comments
 (0)