Android crashes when receiving push notification while app is dead - React-Native

3

i recently implemented push notification for an app and everything work fine both on android and ios but the problem is the device receives push notification while app is on dead state the app crashes.

i am using react-native-firebase and react-native-push-notifications i followed the exact instructions from the docs of these two libraries.

verisons:

"@react-native-community/push-notification-ios": "^1.4.1",
    "@react-native-firebase/app": "^8.4.1",
    "@react-native-firebase/messaging": "^7.8.3",
"react-native-push-notification": "^5.0.1",

EDIT: the app was originally in expo and i did expo eject (just in case this helps)

here is the error message i got from logcat right after sending push notifications

09-09 08:18:41.867  1277  1299 D StorageManagerService: getExternalStorageMountMode : final mountMode=1, uid : 10412, packageName : com.lawyr
09-09 08:18:41.867  1277  1299 I ApplicationPolicy: isApplicationExternalStorageWhitelisted:com.lawyr user:0
09-09 08:18:41.867  1277  1299 D ActivityManager: package  com.lawyr, user - 0 is SDcard whitelisted
09-09 08:18:41.867  1277  1299 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.lawyr user:0
09-09 08:18:41.868  1277  1299 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.lawyr user:0
09-09 08:18:41.891  1277  1301 I ActivityManager: Start proc 20576:com.lawyr/u0a412 for broadcast com.lawyr/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingReceiver
09-09 08:18:41.910 20576 20576 I com.lawyr: Late-enabling -Xcheck:jni
09-09 08:18:41.982 20576 20576 I com.lawyr: report jit thread pid = 20581
09-09 08:18:42.012  1277  3404 I ActivityManager: DSS on for com.lawyr and scale is 1.0
09-09 08:18:43.466 20576 20576 W com.lawyr: Couldn't clamp region space as there are regions in use beyond growth limit.
09-09 08:18:43.753 20576 20602 W com.lawyr: Unsupported class loader
09-09 08:18:43.760 20576 20602 W com.lawyr: Skipping duplicate class check due to unsupported classloader
09-09 08:18:43.992  1277  3385 W ActivityManager: wait for provider publish: waiters=1 callerApp=ProcessRecord{144d3e9d0 20576:com.lawyr/u0a412} cpr=ContentProviderRecord{215686e u0 com.google.android.gsf/.gservices.GservicesProvider}
09-09 08:18:44.062 20576 20576 E AndroidRuntime: Process: com.lawyr, PID: 20576
09-09 08:18:44.076  1277  3712 W ActivityManager: crash : com.lawyr,0
09-09 08:18:44.086  2211  2211 W GCM     : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.lawyr (has extras) }
09-09 08:18:44.147  1277  3404 I ActivityManager: Process com.lawyr (pid 20576) has died: fore SVC (160,1102)
09-09 08:18:44.148  1277  3404 W ActivityManager: Scheduling restart of crashed service com.lawyr/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingHeadlessService in 1000ms
09-09 08:18:44.323 20634 20656 D AppErrorNotification: errorType : 24, process : com.lawyr , uid : 0
09-09 08:18:45.150  1277  1299 D StorageManagerService: getExternalStorageMountMode : final mountMode=1, uid : 10412, packageName : com.lawyr
09-09 08:18:45.151  1277  1299 I ApplicationPolicy: isApplicationExternalStorageWhitelisted:com.lawyr user:0
09-09 08:18:45.151  1277  1299 D ActivityManager: package  com.lawyr, user - 0 is SDcard whitelisted
09-09 08:18:45.151  1277  1299 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.lawyr user:0
09-09 08:18:45.151  1277  1299 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.lawyr user:0
09-09 08:18:45.168  1277  1301 I ActivityManager: Start proc 20678:com.lawyr/u0a412 for service com.lawyr/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingHeadlessService
09-09 08:18:45.185 20678 20678 I com.lawyr: Late-enabling -Xcheck:jni
09-09 08:18:45.252 20678 20678 I com.lawyr: report jit thread pid = 20683
09-09 08:18:45.283  1277  3404 I ActivityManager: DSS on for com.lawyr and scale is 1.0
09-09 08:18:46.793 20678 20678 W com.lawyr: Couldn't clamp region space as there are regions in use beyond growth limit.
09-09 08:18:47.104 20678 20702 W com.lawyr: Unsupported class loader
09-09 08:18:47.107 20678 20702 W com.lawyr: Skipping duplicate class check due to unsupported classloader
09-09 08:18:47.258 20634 20656 V FasUtils: There is com.lawyr [10412] in FAS table
09-09 08:18:47.264 20678 20678 I com.lawyr: Waiting for a blocking GC ClassLinker
09-09 08:18:47.342 20678 20678 I com.lawyr: WaitForGcToComplete blocked ClassLinker on ClassLinker for 77.385ms
09-09 08:18:47.355 20634 20656 V AppErrorNotification: Filtered due to 1day concept : com.lawyr / uid : 10412
09-09 08:18:47.428 20678 20678 E AndroidRuntime: Process: com.lawyr, PID: 20678
09-09 08:18:47.440  1277  2239 W ActivityManager: crash : com.lawyr,0
09-09 08:18:47.445  1277  1300 I ActivityManager: Showing crash dialog for package com.lawyr u0
09-09 08:18:47.523   501   766 I SurfaceFlinger: id=14168 createSurf (2960x2960),2 flag=4, 4008ef5 Application Error: com.lawyr#0
09-09 08:18:47.534  1277  1300 V WindowManager: Changing focus from Window{245b9a2 u0 com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity} to Window{4008ef5 u0 Application Error: com.lawyr} Callers=com.android.server.wm.WindowManagerService.addWindow:1801 com.android.server.wm.Session.addToDisplayForTranslate:244 android.view.ViewRootImpl.setView:1006 android.view.WindowManagerGlobal.addView:381 
09-09 08:18:47.542  1277  1313 D WindowManager: reportFocusChangedSerialized, focused=true, inTouchMode=true, win=Window{4008ef5 u0 Application Error: com.lawyr}
09-09 08:18:47.551  1277  1300 V WindowManager: Relayout Window{4008ef5 u0 Application Error: com.lawyr}: viewVisibility=0 req=719x339 {(0,0)(wrapxwrap) gr=BOTTOM CENTER_VERTICAL sim={adjust=pan forwardNavigation} ty=SYSTEM_ALERT fmt=TRANSLUCENT wanim=0x10302ee surfaceInsets=Rect(4, 4 - 4, 4)
09-09 08:18:47.556  1277  1300 V WindowManager: Resize reasons for w=Window{4008ef5 u0 Application Error: com.lawyr}:  contentInsetsChanged=false [0,0][0,0] visibleInsetsChanged=false [0,0][0,0] stableInsetsChanged=false [0,0][0,0] outsetsChanged=false [0,0][0,0] surfaceResized=false configChanged=true dragResizingChanged=false reportOrientationChanged=false displayCutoutChanged=false nextForceRelayoutToClient=false
09-09 08:18:47.559   501   527 I SurfaceFlinger: id=14169 createSurf (727x347),1 flag=4, Application Error: com.lawyr#0
09-09 08:18:47.560  1277  1300 D WindowManager: makeSurface duration=2 name=Application Error: com.lawyr
09-09 08:18:47.573  1277  1300 D WindowManager: setSystemUiVisibility: vis= 0x8008, fullscreenVis= 0x0, dockedVis= 0x0, win=Window{4008ef5 u0 Application Error: com.lawyr}
09-09 08:18:47.589 20634 20737 D AppErrorNotification: errorType : 24, process : com.lawyr , uid : 0
09-09 08:18:47.622  1277  1300 D WindowManager: finishDrawingWindow: Window{4008ef5 u0 Application Error: com.lawyr} mDrawState=DRAW_PENDING
09-09 08:18:47.626  1277  1548 I WindowManager: commitFinishDrawingLocked: mDrawState=READY_TO_SHOW Surface(name=Application Error: com.lawyr)/@0xcb6bd7
09-09 08:18:47.627  1277  1548 I WindowManager: Cancelling animation restarting=true, leash=null, surface=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad, parent=Surface(name=WindowToken{8f7f42c android.view.ViewRootImpl$W@f3b5fdf})/@0x2044ae2
09-09 08:18:47.627  1277  1548 I WindowManager: Reparenting to leash, surface=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad
09-09 08:18:47.628   501   766 I SurfaceFlinger: id=14170 createSurf (2960x2960),2 flag=4, Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash#0
09-09 08:18:47.630  1277  1548 D WindowManager: makeSurface duration=2 leash=Surface(name=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash)/@0x770ee73
09-09 08:18:47.630  1277  1548 D SurfaceControl: reparent is called, sc=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad, newParentHandle=android.os.BinderProxy@3aec130, transaction=android.view.SurfaceControl$Transaction@b6511a9
09-09 08:18:47.630  1277  1548 V WindowManager: performShowLocked: mDrawState=HAS_DRAWN in Window{4008ef5 u0 Application Error: com.lawyr}
09-09 08:18:47.641   501   527 D Layer   : [4008ef5 Application Error: com.lawyr#0]::reparent oldParent:[WindowToken{8f7f42c android.view.ViewRootImpl$W@f3b5fdf}#0], newParent:[Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash#0]
09-09 08:18:47.677   501   501 I SurfaceFlinger:      Device | 0xa86f2e80 | 0000 | RGBA_8888 |   4.0    0.0  724.0  347.0 |    0 1099  720 1446 | Application Error: com.lawyr#0
09-09 08:18:47.695   501   501 I SurfaceFlinger:      Client | 0xa86f2e80 | 0000 | RGBA_8888 |   4.0    0.0  724.0  347.0 |    0 1092  720 1439 | Application Error: com.lawyr#0
09-09 08:18:47.830 20678 20712 I FA      :   adb shell setprop debug.firebase.analytics.app com.lawyr
09-09 08:18:47.867 20634 20737 V FasUtils: There is com.lawyr [10412] in FAS table
09-09 08:18:47.913 20634 20737 V AppErrorNotification: Filtered due to 1day concept : com.lawyr / uid : 10412
09-09 08:18:47.945  1277  1548 I WindowManager: reset, Reparenting to original parent, shouldDeferScheduleAnimation=false, destroyLeash=true, surface=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad, parent=Surface(name=WindowToken{8f7f42c android.view.ViewRootImpl$W@f3b5fdf})/@0x2044ae2, parentNativeHandle=android.os.BinderProxy@56c4ce1, caller=com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:97 com.android.server.wm.-$$Lambda$SurfaceAnimator$SIBia0mND666K8lMCPsoid8pUTI.run:4 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$1:104 com.android.server.wm.-$$Lambda$SurfaceAnimator$vdRZk66hQVbQCvVXEaQCT1kVmFc.onAnimationFinished:4 com.android.server.wm.LocalAnimationAdapter.lambda$startAnimation$0:74 
09-09 08:18:47.945  1277  1548 D SurfaceControl: reparent is called, sc=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad, newParentHandle=android.os.BinderProxy@56c4ce1, transaction=android.view.SurfaceControl$Transaction@b6511a9
09-09 08:18:47.945  1277  1548 D SurfaceControl: destroy(transaction), animation-leash is destroyed, sc=Surface(name=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash)/@0x770ee73, transaction=android.view.SurfaceControl$Transaction@b6511a9, caller=com.android.server.wm.SurfaceAnimator.reset:344 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:97 com.android.server.wm.-$$Lambda$SurfaceAnimator$SIBia0mND666K8lMCPsoid8pUTI.run:4 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$1:104 com.android.server.wm.-$$Lambda$SurfaceAnimator$vdRZk66hQVbQCvVXEaQCT1kVmFc.onAnimationFinished:4 com.android.server.wm.LocalAnimationAdapter.lambda$startAnimation$0:74 com.android.server.wm.-$$Lambda$LocalAnimationAdapter$X--EomqUvw4qy89IeeTFTH7aCMo.run:4 
09-09 08:18:47.947  1277  1548 D WindowManager: prepareSurfaces, request to clear saved leash, surface=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad
09-09 08:18:47.948   501   766 D Layer   : [4008ef5 Application Error: com.lawyr#0]::reparent oldParent:[Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash#0], newParent:[WindowToken{8f7f42c android.view.ViewRootImpl$W@f3b5fdf}#0]
09-09 08:18:47.948   501   766 I SurfaceFlinger: id=14170 Removed Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash#0 (1/44)
09-09 08:18:47.950  1277  1548 D WindowManager: clearSavedLeashOnCommit, savedLeash=Surface(name=Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash)/@0x770ee73, caller=com.android.server.wm.WindowContainer.clearSavedLeashOnCommit:1156 com.android.server.wm.WindowContainer.clearSavedLeashOnCommit:1160 com.android.server.wm.WindowContainer.clearSavedLeashOnCommit:1160 com.android.server.wm.WindowContainer.clearSavedLeashOnCommit:1160 com.android.server.wm.RootWindowContainer.performSurfacePlacement:796 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:212 
09-09 08:18:47.954   501   501 I Layer   : id=14170 onRemoved Surface(name=4008ef5 Application Error: com.lawyr)/@0x238a7ad - animation-leash#0

Manifest File

<meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
                android:value="Group Test"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
                    android:value="Notify the status of on-going group tests and receive invitations for group tests"/>

        <!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="false"/>
        <!-- Change the value to false if you don't want the creation of the default channel -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.channel_create_default"
                    android:value="true"/>
        <!-- Change the resource name to your App's accent color - or any other color you want -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <service
            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

please tell me if i need to provide more code, Thanks.

android
react-native
push-notification
firebase-cloud-messaging
asked on Stack Overflow Sep 9, 2020 by Travis • edited Sep 9, 2020 by Travis

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0