Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by java.lang.NoSuchMethodError: No virtual method stopForeground on Android 6 #744

Open
1 of 3 tasks
alpha2048 opened this issue Nov 2, 2023 · 3 comments
Open
1 of 3 tasks

Comments

@alpha2048
Copy link

Bug report

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

According to Crashlytics, This crash is occurring on Android 6.

stopForeground requires Android7 or higher.

Steps to Reproduce

  1. receive a call in background on Android 6.
  2. end the call via reportEndCallWithUUID

Versions

- Callkeep: 4.3.9
- React Native: 0.69.12
- iOS:
- Android: 6
- Phone model: 

Logs

Caused by java.lang.NoSuchMethodError: No virtual method stopForeground(I)V in class Lio/wazo/callkeep/VoiceConnectionService; or its super classes (declaration of 'io.wazo.callkeep.VoiceConnectionService' appears in xxx.apk)
       at io.wazo.callkeep.VoiceConnectionService.stopForegroundService(VoiceConnectionService.java:356)
       at io.wazo.callkeep.VoiceConnectionService.deinitConnection(VoiceConnectionService.java:159)
       at io.wazo.callkeep.VoiceConnection.reportDisconnect(VoiceConnection.java:167)
       at io.wazo.callkeep.RNCallKeepModule.reportEndCallWithUUID(RNCallKeepModule.java:582)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:815)
       at android.os.Handler.dispatchMessage(Handler.java:104)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loop(Looper.java:207)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
       at java.lang.Thread.run(Thread.java:818)
@alpha2048
Copy link
Author

alpha2048 commented Nov 3, 2023

I already set this, is something wrong?
android:foregroundServiceType="camera|microphone|phoneCall"

@ramijarrar
Copy link
Contributor

ramijarrar commented Nov 3, 2023

The problem is this line which should be using the legacy stopForeground(boolean) method on Android 6 to maintain backwards compatibility.

I have an existing PR #742 to fix the current implementation unrelated to this.

I could amend it to also support the legacy API, but there are other issues you may run into with really old Android versions (e.g. checkIsInManagedCall requires Android 8+).

@alpha2048
Copy link
Author

alpha2048 commented Nov 3, 2023

I think only add Build.VERSION.SDK_INT > Build.VERSION_CODES.N condition like flutter callkeep.

according to this line, Android 7 or below don't support Foreground Service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants