diff --git a/README.md b/README.md index bcb2c960..22b0bb56 100644 --- a/README.md +++ b/README.md @@ -662,7 +662,7 @@ _This feature is available only on Android._ _On iOS you still have to call `setup()`._ ```js -RNCallKeep.registerPhoneAccount(); +RNCallKeep.registerPhoneAccount(options); ``` ### registerAndroidEvents diff --git a/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java b/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java index 5336c9c9..5b62d33e 100644 --- a/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java +++ b/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java @@ -156,7 +156,7 @@ public void setup(ReadableMap options) { } if (isConnectionServiceAvailable()) { - this.registerPhoneAccount(); + this.registerPhoneAccount(options); this.registerEvents(); VoiceConnectionService.setAvailable(true); } @@ -165,7 +165,9 @@ public void setup(ReadableMap options) { } @ReactMethod - public void registerPhoneAccount() { + public void registerPhoneAccount(ReadableMap options) { + this._settings = options; + if (!isConnectionServiceAvailable()) { Log.w(TAG, "[VoiceConnection] registerPhoneAccount ignored due to no ConnectionService"); return; diff --git a/index.d.ts b/index.d.ts index 736ee0b9..1259d5c2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -79,7 +79,7 @@ declare module 'react-native-callkeep' { static answerIncomingCall(uuid: string): void - static registerPhoneAccount(): void + static registerPhoneAccount(options: IOptions): void static registerAndroidEvents(): void diff --git a/index.js b/index.js index 0ba70c1c..1ce9b43c 100644 --- a/index.js +++ b/index.js @@ -48,11 +48,11 @@ class RNCallKeep { return this._setupIOS(options.ios); }; - registerPhoneAccount = () => { + registerPhoneAccount = (options) => { if (isIOS) { return; } - RNCallKeepModule.registerPhoneAccount(); + RNCallKeepModule.registerPhoneAccount(options.android); }; registerAndroidEvents = () => {