Skip to content

Commit 4cdf17f

Browse files
authored
Merge pull request #234 from react-native-webrtc/revert_wakeup_app
Android: Revert wakeUpApplication to use react-native class
2 parents 082b0d0 + a03628c commit 4cdf17f

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

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

+15-5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import android.app.ActivityManager;
4141
import android.app.ActivityManager.RunningTaskInfo;
4242

43+
import com.facebook.react.HeadlessJsTaskService;
44+
4345
import java.util.ArrayList;
4446
import java.util.HashMap;
4547
import java.util.Iterator;
@@ -190,11 +192,19 @@ private Connection makeOutgoingCall(ConnectionRequest request, String uuid, Bool
190192
}
191193

192194
private void wakeUpApplication(String uuid, String number, String displayName) {
193-
HashMap<String, String> extrasMap = new HashMap();
194-
extrasMap.put(EXTRA_CALL_UUID, uuid);
195-
extrasMap.put(EXTRA_CALLER_NAME, displayName);
196-
extrasMap.put(EXTRA_CALL_NUMBER, number);
197-
sendCallRequestToActivity(ACTION_WAKE_APP, extrasMap);
195+
Intent headlessIntent = new Intent(
196+
this.getApplicationContext(),
197+
RNCallKeepBackgroundMessagingService.class
198+
);
199+
headlessIntent.putExtra("callUUID", uuid);
200+
headlessIntent.putExtra("name", displayName);
201+
headlessIntent.putExtra("handle", number);
202+
Log.d(TAG, "wakeUpApplication: " + uuid + ", number : " + number + ", displayName:" + displayName);
203+
204+
ComponentName name = this.getApplicationContext().startService(headlessIntent);
205+
if (name != null) {
206+
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
207+
}
198208
}
199209

200210
private void wakeUpAfterReachabilityTimeout(ConnectionRequest request) {

0 commit comments

Comments
 (0)