react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
897 stars 436 forks source link

[Android] Bug/Error when using selfManaged mode. #424

Open anwersolangi opened 3 years ago

anwersolangi commented 3 years ago

Bug report

I have encountered a bug, if selfManaged mode is set to true and use displayIncomingCall without number parameter, then a error occur with no information of error, except ssp. On further debugging, I see that there is a function fromParts at line 189 in RNCallKeepModule.java, code: Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null); Is it a bug or something necessary to use connectionservice?

Steps to Reproduce

  1. Create new project, install react-native-callkeep.
  2. set selfManaged true, and use RNCallKeep.displayIncomingCall(uuid(),null,notification.data?.username,null,true);

Versions

- Callkeep: 4.2.0
- React Native: 0.63.4
- iOS:
- Android: 10
- Phone model: Moto One Macro 
manuquentin commented 3 years ago

Hi @anwersolangi thanks for the report.

Yeah I don't think that the handle is required in self managed, can you try with line 196 and 198 commented out in android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java ?

Meanwhile you can try with :

RNCallKeep.displayIncomingCall(uuid(),'',notification.data?.username,null,true);

Using an empty string instead of null as the number parameter.

anwersolangi commented 3 years ago

Hi @anwersolangi thanks for the report.

Yeah I don't think that the handle is required in self managed, can you try with line 196 and 198 commented out in android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java ?

Meanwhile you can try with :

RNCallKeep.displayIncomingCall(uuid(),'',notification.data?.username,null,true);

Using an empty string instead of null as the number parameter.

Yeah i have already tried it with empty string, and if we use empty string, then the notification of incomingcall is only shown if the system phone app is opened, or if someone is calling us, but the event showIncomingCallUi is fired.

agam-colaburate commented 3 years ago

+1 Any update or workaround ? @manuquentin @anwersolangi ?

I tried commenting the lines you mentioned, it crashes :

2021-05-22 21:35:43.997 4170-4170/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.appname, PID: 4170 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference at io.wazo.callkeep.VoiceConnectionService.createConnection(VoiceConnectionService.java:334) at io.wazo.callkeep.VoiceConnectionService.onCreateIncomingConnection(VoiceConnectionService.java:153) at android.telecom.ConnectionService.createConnection(ConnectionService.java:1550) at android.telecom.ConnectionService.access$400(ConnectionService.java:88) at android.telecom.ConnectionService$2$1.loggedRun(ConnectionService.java:728) at android.telecom.Logging.Runnable$1.run(Runnable.java:37) at android.telecom.ConnectionService.onAccountsInitialized(ConnectionService.java:2482) at android.telecom.ConnectionService.access$4100(ConnectionService.java:88) at android.telecom.ConnectionService$5$1.loggedRun(ConnectionService.java:1944) at android.telecom.Logging.Runnable$1.run(Runnable.java:37) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6692) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

agam-colaburate commented 3 years ago

@manuquentin @anwersolangi
Any lead on this ?

namnm commented 3 years ago

Why dont we just put something instead of null/empty string? Like Unknown or App Name?