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

App crashes when answering a call from app killed state when using out-of-band Firebase Messaging service on Android #445

Open
3 tasks done
aaronleo28 opened this issue Nov 4, 2024 · 4 comments
Assignees

Comments

@aaronleo28
Copy link

Issue

Pre-submission Checklist

  • I have verified that the issue occurs with the latest release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Description

I'm building an Expo react native app that uses this SDK alongside our own @react-native-firebase/messaging service that I use to receive push notifications sent from our backend.

I was happy to see the 1.2.1 release go out which unblocked us from using firebase messaging in our app for Android with the introduction of support for an out-of-band Firebase service.

I set this up following this guide and everything works well except responding to calls made while the app is killed and the screen is off.

Calls made while the app is foregrounded or backgrounded work as expected, the issue only occurs when trying to answer a call via the notification presented when the app is killed and the screen is off.

Reproduction Steps

  1. Add an out of band Firebase service as per the docs
  2. fully close the app and turn off the screen
  3. make a call to the device
  4. try answer the call by pressing the notification
  5. see the app crash

Expected Behavior

I would expect the same behaviour that is observed when not using an out of band Firebase service, ie that a full-screen accept/reject call view is presented, as well as the incoming call notification, which can be used to answer the call successfully

Actual Behavior

The device will call, and a notification can be seen, but pressing the notification tries to open the app which will then crash. Also, the full screen accept/reject call view isn't visible

Reproduction Frequency

100%

Screenshots

If applicable, add screenshots to help explain your problem.

Software and Device Information

Please complete the following information.

  • Device: Samsung Galaxy S10e
  • OS: Android 12
  • React version: 18.2.0
  • React Native version: 0.74.5
  • Node version: 20.11.0
  • npm or yarn version: 1.22.19
  • expo version: 51.0.34
  • react-native-firebase version: 20.4.0
@mhuynh5757 mhuynh5757 self-assigned this Nov 4, 2024
@mhuynh5757
Copy link
Collaborator

Hi @aaronleo28 thanks for bringing this to our attention. I indeed tested the "app killed" use-case before release, so let's dig into this and see if we can resolve the issue. Could you get the logcats and post any errors you see here?

@aaronleo28
Copy link
Author

@mhuynh5757 thanks for the speedy reply, I've included the logcats below, filtered for warnings and above

btw, the behaviour is as expected when the screen is on and the app is killed - the issue only arises when the app is killed and the screen is off

11-05 14:09:23.802 11865 11865 E USNET   : USNET: appName: com.example.exampleapp
11-05 14:09:23.936 11865 11865 W SoLoader: Recording new base apk path: /data/app/~~5WqSM2cqaz-kqTfs-AFxrQ==/com.example.exampleapp-jbIBdWzXWNHg1_BeluTNoQ==/base.apk
11-05 14:09:23.936 11865 11865 W SoLoader: Previously recorded 0 base apk paths.
11-05 14:09:25.348  1095  4742 W ActivityTaskManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=ACTION_FOREGROUND_AND_DEPRIORITIZE_INCOMING_CALL_NOTIFICATION cmp=com.example.exampleapp/.MainActivity (has extras) }
11-05 14:09:25.528 11865 11865 E AndroidRuntime: FATAL EXCEPTION: main
11-05 14:09:25.528 11865 11865 E AndroidRuntime: Process: com.example.exampleapp, PID: 11865
11-05 14:09:25.528 11865 11865 E AndroidRuntime: java.lang.RuntimeException: Unable to pause activity {com.example.exampleapp/com.example.exampleapp.MainActivity}: java.lang.reflect.InvocationTargetException
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5557)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5508)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5460)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:226)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:313)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8663)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at expo.modules.ReactActivityDelegateWrapper.invokeDelegateMethod(ReactActivityDelegateWrapper.kt:328)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at expo.modules.ReactActivityDelegateWrapper.onPause(ReactActivityDelegateWrapper.kt:203)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.facebook.react.ReactActivity.onPause(ReactActivity.java:53)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.Activity.performPause(Activity.java:8485)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1530)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5547)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	... 14 more
11-05 14:09:25.528 11865 11865 E AndroidRuntime: Caused by: java.lang.AssertionError
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:82)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:597)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.facebook.react.ReactDelegate.onHostPause(ReactDelegate.java:134)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:134)
11-05 14:09:25.528 11865 11865 E AndroidRuntime: 	... 21 more
11-05 14:09:25.537  1095  4229 W ActivityManager: crash : com.example.exampleapp,10347
11-05 14:09:25.538  1095  4229 W ActivityTaskManager:   Force finishing activity com.example.exampleapp/.MainActivity
11-05 14:09:25.635  1095  4742 W InputManager-JNI: Input channel object 'b02ec4a com.example.exampleapp/com.example.exampleapp.MainActivity (client)' was disposed without first being removed with the input manager!
11-05 14:09:25.635  1095  2714 W ActivityManager: Scheduling restart of crashed service com.example.exampleapp/com.twiliovoicereactnative.VoiceService in 1000ms for start-requested
11-05 14:09:25.644  1095  2714 W InputManager-JNI: Input channel object '95c9daf Splash Screen com.example.exampleapp (client)' was disposed without first being removed with the input manager!
11-05 14:09:26.700 12007 12007 E USNET   : USNET: appName: com.example.exampleapp
11-05 14:09:26.957 12007 12007 W SoLoader: Recording new base apk path: /data/app/~~5WqSM2cqaz-kqTfs-AFxrQ==/com.example.exampleapp-jbIBdWzXWNHg1_BeluTNoQ==/base.apk
11-05 14:09:26.957 12007 12007 W SoLoader: Previously recorded 0 base apk paths.
11-05 14:09:26.994 12007 12007 E AndroidRuntime: FATAL EXCEPTION: main
11-05 14:09:26.994 12007 12007 E AndroidRuntime: Process: com.example.exampleapp, PID: 12007
11-05 14:09:26.994 12007 12007 E AndroidRuntime: java.lang.RuntimeException: Unable to start service com.twiliovoicereactnative.VoiceService@7a3ee44 with Intent { act=ACTION_FOREGROUND_AND_DEPRIORITIZE_INCOMING_CALL_NOTIFICATION cmp=com.example.exampleapp/com.twiliovoicereactnative.VoiceService (has extras) }: java.lang.NullPointerException
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5110)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.app.ActivityThread.access$2200(ActivityThread.java:310)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2319)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:226)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:313)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8663)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: Caused by: java.lang.NullPointerException
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at java.util.Objects.requireNonNull(Objects.java:220)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at com.twiliovoicereactnative.VoiceService.getCallRecord(VoiceService.java:390)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at com.twiliovoicereactnative.VoiceService.onStartCommand(VoiceService.java:135)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5092)
11-05 14:09:26.994 12007 12007 E AndroidRuntime: 	... 9 more
11-05 14:09:26.999  1095  2026 W ActivityManager: crash : com.example.exampleapp,10347
11-05 14:09:27.079  1095 15363 W ActivityManager: Scheduling restart of crashed service com.example.exampleapp/com.twiliovoicereactnative.VoiceService in 1800000ms for start-requested
11-05 14:09:31.322  1095  4742 W ActivityTaskManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=ACTION_FOREGROUND_AND_DEPRIORITIZE_INCOMING_CALL_NOTIFICATION cmp=com.example.exampleapp/.MainActivity (has extras) }
11-05 14:09:31.375 12141 12141 E USNET   : USNET: appName: com.example.exampleapp
11-05 14:09:31.451 12141 12141 W SoLoader: Recording new base apk path: /data/app/~~5WqSM2cqaz-kqTfs-AFxrQ==/com.example.exampleapp-jbIBdWzXWNHg1_BeluTNoQ==/base.apk
11-05 14:09:31.451 12141 12141 W SoLoader: Previously recorded 0 base apk paths.
11-05 14:09:31.506 12141 12141 E AndroidRuntime: FATAL EXCEPTION: main
11-05 14:09:31.506 12141 12141 E AndroidRuntime: Process: com.example.exampleapp, PID: 12141
11-05 14:09:31.506 12141 12141 E AndroidRuntime: java.lang.RuntimeException: Unable to start service com.twiliovoicereactnative.VoiceService@4912a0f with Intent { act=ACTION_FOREGROUND_AND_DEPRIORITIZE_INCOMING_CALL_NOTIFICATION cmp=com.example.exampleapp/com.twiliovoicereactnative.VoiceService (has extras) }: java.lang.NullPointerException
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5110)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.app.ActivityThread.access$2200(ActivityThread.java:310)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2319)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:226)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:313)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8663)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: Caused by: java.lang.NullPointerException
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at java.util.Objects.requireNonNull(Objects.java:220)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at com.twiliovoicereactnative.VoiceService.getCallRecord(VoiceService.java:390)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at com.twiliovoicereactnative.VoiceService.onStartCommand(VoiceService.java:135)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5092)
11-05 14:09:31.506 12141 12141 E AndroidRuntime: 	... 9 more
11-05 14:09:31.508  1095  2773 W ActivityManager: crash : com.example.exampleapp,10347
11-05 14:09:31.509  1095  2773 W ActivityTaskManager:   Force finishing activity com.example.exampleapp/.MainActivity
11-05 14:09:32.011  1095  1455 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{9cd942f u0 com.example.exampleapp/.MainActivity t316 f}}
11-05 14:09:32.022  1095  1455 W ActivityTaskManager: Activity pause timeout for ActivityRecord{9cd942f u0 com.example.exampleapp/.MainActivity t316 f}}
11-05 14:09:32.036  1095  4742 W InputManager-JNI: Input channel object '9c8d60f Splash Screen com.example.exampleapp (client)' was disposed without first being removed with the input manager!
11-05 14:09:32.040  1095  1456 E WindowManager: win=Window{9c8d60f u0 Splash Screen com.example.exampleapp EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=8 caller=com.android.server.wm.ActivityRecord.destroySurfaces:5848 com.android.server.wm.ActivityRecord.destroySurfaces:5829 com.android.server.wm.WindowState.onExitAnimationDone:5975 com.android.server.wm.ActivityRecord$$ExternalSyntheticLambda13.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.ActivityRecord.onAnimationFinished:7897 com.android.server.wm.ActivityRecord.postApplyAnimation:5579
11-05 14:09:42.054  1095  1455 W ActivityTaskManager: Activity destroy timeout for ActivityRecord{9cd942f u0 com.example.exampleapp/.MainActivity t316 f}}
11-05 14:09:42.055  1095  1455 W InputManager-JNI: Input channel object '13f2656 com.example.exampleapp/com.example.exampleapp.MainActivity (client)' was disposed without first being removed with the input manager!
11-05 14:09:45.315  1095  1470 W BroadcastQueue: Receiver during timeout of BroadcastRecord{d894472 u0 com.google.android.c2dm.intent.RECEIVE} : ResolveInfo{7028d1b com.example.exampleapp/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingReceiver m=0x108000}
11-05 14:09:55.319  1095  1470 W BroadcastQueue: Receiver during timeout of BroadcastRecord{d894472 u0 com.google.android.c2dm.intent.RECEIVE} : ResolveInfo{55f7156 com.example.exampleapp/com.google.firebase.iid.FirebaseInstanceIdReceiver m=0x108000}
11-05 14:09:55.325 24420 24420 W GCM     : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.example.exampleapp (has extras) }
11-05 14:10:01.493  1095  1470 W ActivityManager: Timeout executing service: ServiceRecord{7f60232 u0 com.example.exampleapp/com.twiliovoicereactnative.VoiceService}

@mhuynh5757
Copy link
Collaborator

Thanks! We'll look into it further.

@aaronleo28
Copy link
Author

happy friday @mhuynh5757 are there any updates on the above issue?

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