voxeet / voxeet-uxkit-cordova

Dolby.io UXKit for Cordova
Other
1 stars 14 forks source link

Android app crashes on invitation. v1.5.8 #77

Closed rooneyl closed 1 year ago

rooneyl commented 1 year ago

Describe the bug Application crashes when call invitation is received.

Expected Behaviour Should receive voip notification.

Steps to Reproduce the Problem on v1.5.8 initiate call invitation from web.

Then, cordova app crashes with

    java.lang.RuntimeException: Unable to create service com.voxeet.uxkit.incoming.implementation.DefaultIncomingNotificationService: java.lang.IllegalArgumentException: foregroundServiceType 0x000000C0 is not a subset of foregroundServiceType attribute 0x00000000 in service element of manifest file
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:4567)
        at android.app.ActivityThread.access$1700(ActivityThread.java:256)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7870)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     Caused by: java.lang.IllegalArgumentException: foregroundServiceType 0x000000C0 is not a subset of foregroundServiceType attribute 0x00000000 in service element of manifest file
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2430)
        at android.os.Parcel.createException(Parcel.java:2410)
        at android.os.Parcel.readException(Parcel.java:2393)
        at android.os.Parcel.readException(Parcel.java:2335)
        at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7158)
        at android.app.Service.startForeground(Service.java:790)
        at com.voxeet.uxkit.incoming.AbstractIncomingNotificationService.startForegroundDefault(AbstractIncomingNotificationService.java:130)
        at com.voxeet.uxkit.incoming.AbstractIncomingNotificationService.onCreate(AbstractIncomingNotificationService.java:43)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
        at android.app.ActivityThread.access$1700(ActivityThread.java:256) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7870) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1724)
        at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1351)
        at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:11944)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3230)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2519)

Specifications

codlab commented 1 year ago

really I can't seem to be able to reproduce this issue, however looking at the stack trace it seems that it's because we are asking for service types which are not set in the manifest :

       startForeground(notificationId, lastNotification,
               ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
                       | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);

however the documentation shows that it's possible to use OR as shown in https://developer.android.com/guide/components/foreground-services#loc-camera-mic

<service ... android:foregroundServiceType="location|camera|microphone" />

Also the wording seems to indicate that it's related You can choose to limit access to a subset of the declared service types, as shown in the code snippets within the following sections.

I'll push forward an update in the uxkit library however it may be a bit delayed, in the meantime, you can override the service declared in the Cordova app so that the issue doesn't happen with something like

   <config-file target="AndroidManifest.xml" parent="/manifest/application">
       <service android:name="com.voxeet.uxkit.incoming.implementation.DefaultIncomingNotificationService"
           android:enabled="true"
           android:exported="false"
           android:foregroundServiceType="camera|microphone" />
   </config-file>
rooneyl commented 1 year ago

is there a way to run both voxeet incoming call notification and firebase push notification?

weiz18 commented 1 year ago

Hey, @codlab , we are also experiencing this issue, the workaround suggested with v1.5.8 on capacitor 4 does work 🙏 . However the native invitation dialog does not disappear after accepting the call on android specially with the app opened/minimised/closed (we are reproducing on the following devices

Samsung A51 Android 12 Samsung Galaxy S8 Android 9

codlab commented 1 year ago

v1.5.9 has been released with the latest UXKit and its modifications

@weiz18 can you update and attach the logs from your app?

weiz18 commented 1 year ago

Hey, @codlab , with v1.5.9, we are having the following issue when trying to build on device

Caused by: java.lang.RuntimeException: Duplicate class com.voxeet.uxkit.common.BuildConfig found in modules jetified-uxkit-common-3.7.1-runtime (com.voxeet.sdk:uxkit-common:3.7.1) and jetified-uxkit-common-3.7.5-runtime (io.dolby:uxkit-common:3.7.5)

codlab commented 1 year ago

likely to be relics from the android's build folder. edit : maybe just the capacitor plugin for push notification, I just created a version 0.1.0 which changes the group for the uxkit library, should be fixing the issue

codlab commented 1 year ago

closing as the issue is fixed using the upgraded version of push notification 0.1.0