Skip to content

[Bug] Android postNotification might crashes the app with exceptions #163

Open
@AlexV525

Description

@AlexV525

We've received a couple of crashes caused by the post notification action on specific XiaoMi devices. I'm trying to figure out the root cause.

Version Info

Flutter: 3.27.4
connectycube_flutter_call_kit: 2.8.0
Device: Xiaomi Civi (Android 12)

Fatal Exception: java.lang.IllegalArgumentException: 0|com.example|-1003350140|null|10379 Not posted. CallStyle notifications must either be for a foreground Service or use a fullScreenIntent.
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2429)
       at android.os.Parcel.createException(Parcel.java:2409)
       at android.os.Parcel.readException(Parcel.java:2392)
       at android.os.Parcel.readException(Parcel.java:2334)
       at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:3416)
       at android.app.NotificationManager.notifyAsUser(NotificationManager.java:677)
       at android.app.NotificationManager.notify(NotificationManager.java:627)
       at androidx.core.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:94)
       at androidx.core.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:94)
       at com.connectycube.flutter.connectycube_flutter_call_kit.NotificationsManagerKt.postNotification(NotificationsManager.kt:94)
       at com.connectycube.flutter.connectycube_flutter_call_kit.NotificationsManagerKt$loadPhotoAndPostNotification$1.invokeSuspend(NotificationsManager.kt:122)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:11)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
       at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:19)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:3)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:96)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:96)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:96)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:96)

Permissions (part of) in our AndroidManifest.xml:

    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

Exceptions will cause the app to crash. An expected behavior is not crashing the app and reporting the exception in the channel result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions