Skip to content

Commit c989733

Browse files
committed
Be more defensive when trying to wake the application
1 parent cc308ce commit c989733

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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)