Skip to content

Android: notification is not come (+ crash happened) when app process is killed #743

@AliakseiZhukouski

Description

@AliakseiZhukouski
  1. Is the bug present in the demo Chat SDK project?
    dependencies are:
    sdk.chat:firebase-app:5.4.2"
    sdk.chat:pro-firebase-last-online:5.4.2"

  2. What modifications have you made to the Chat SDK?

  3. Android Version:
    Android 10 (API 29)

  4. Steps taken to reproduce the problem:

  1. create thread 1 by 1 (using user firebase id)
  2. user 1 being in foreground from UI (chat details) send message to thread
  3. user 2 being in background (app process was intentionally killed by swiping up from recent) does not get any notification and from time to time get crash (in 50% of cases) - crash output is below
  1. Expected result:
    Application being in background (when process was killed swiping up from recents) should get notification

  2. Actual result:
    Application is not get any notification and sometimes can even crashes (being in background and killed as process).
    In the logcat output we can see the next crash
    03-18 19:37:39.418 E/AndroidRuntime( 4883): java.lang.RuntimeException: Unable to start receiver sdk.chat.core.push.DefaultBroadcastReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'org.greenrobot.greendao.query.QueryBuilder sdk.chat.core.dao.DaoSession.queryBuilder(java.lang.Class)' on a null object reference
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4238)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.app.ActivityThread.access$1700(ActivityThread.java:274)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2113)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.os.Handler.dispatchMessage(Handler.java:107)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.os.Looper.loop(Looper.java:237)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.app.ActivityThread.main(ActivityThread.java:8167)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at java.lang.reflect.Method.invoke(Native Method)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'org.greenrobot.greendao.query.QueryBuilder sdk.chat.core.dao.DaoSession.queryBuilder(java.lang.Class)' on a null object reference
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at sdk.chat.core.session.StorageManager.fetchEntityWithEntityID(StorageManager.java:162)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at sdk.chat.core.session.StorageManager.fetchThreadWithEntityID(StorageManager.java:209)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at sdk.chat.core.push.BaseBroadcastHandler.onReceive(BaseBroadcastHandler.java:34)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at sdk.chat.core.push.DefaultBroadcastReceiver.onReceive(DefaultBroadcastReceiver.java:18)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4229)
    03-18 19:37:39.418 E/AndroidRuntime( 4883): ... 8 more

  3. Comments:

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