Appboy / appboy-android-sdk

Public repo for the Braze Android SDK
https://www.braze.com
Other
152 stars 102 forks source link

[Bug]: Fire TV, Push Notification, Crash on open #248

Closed iNdieboyjeff closed 1 year ago

iNdieboyjeff commented 2 years ago

Braze Android SDK Version

23.3.0"

Steps To Reproduce

Send a Fire OS push notification to a Fire TV device

Expected Behavior

When receiving the push you should be able to press the burger button on the remote to open the app

Actual Incorrect Behavior

App crashes and does not open when handling the Intent

Verbose Logs

2022-11-02 10:13:16.402 13695-14280 Braze v23....shReceiver xxx.xxxx.xxxxxx                      I  Received broadcast message. Message: Intent { act=com.amazon.device.messaging.intent.RECEIVE cat=[xxx.xxxx.xxxxxx] flg=0x10 pkg=xxx.xxxx.xxxxxx cmp=xxx.xxxx.xxxxxx/com.braze.push.BrazeAmazonDeviceMessagingReceiver (has extras) }
2022-11-02 10:13:16.431 13695-14280 Braze v23....shReceiver xxx.xxxx.xxxxxx                      I  Push message payload received: Bundle[{adm_message_priority=NORMAL, a=This is a Kindle Push notification, p=1, s=Something something gin someting, t=Hayu_Dev, _ab=true, cid=dGVzdF90ZXN0X2RpPTYzNjIzNGFiYjhmYjhiNDFkOGE4YjYzOGNmZDQ0M2U4, adm_message_md5=GMb4Ymnk9xrmA1AJtQP0vA==}]
2022-11-02 10:13:18.702 13695-14280 Braze v23....shReceiver xxx.xxxx.xxxxxx                      I  Received broadcast message. Message: Intent { act=com.appboy.action.APPBOY_PUSH_CLICKED cmp=xxx.xxxx.xxxxxx/com.braze.push.BrazeAmazonDeviceMessagingReceiver (has extras) }
2022-11-02 10:13:18.705 13695-13922 Braze v23.3.0 .Braze    xxx.xxxx.xxxxxx                      I  Logging push click. Campaign Id: dGVzdF90ZXN0X2RpPTYzNjIzNGFiYjhmYjhiNDFkOGE4YjYzOGNmZDQ0M2U4
2022-11-02 10:13:18.716 13695-13922 Braze v23.3.0 .y0       xxx.xxxx.xxxxxx                      I  Requesting trigger update due to trigger-eligible push click event
2022-11-02 10:13:18.791 13695-14280 Braze v23....ationUtils xxx.xxxx.xxxxxx                      E  Exception occurred attempting to handle notification opened intent.
                                                                                                    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Intent.getFlags()' on a null object reference
                                                                                                        at android.app.ContextImpl.startActivity(ContextImpl.java:813)
                                                                                                        at android.app.ContextImpl.startActivity(ContextImpl.java:797)
                                                                                                        at android.content.ContextWrapper.startActivity(ContextWrapper.java:356)
                                                                                                        at com.braze.push.BrazeNotificationUtils.routeUserWithNotificationOpenedIntent(BrazeNotificationUtils.kt:187)
                                                                                                        at com.braze.push.BrazeNotificationUtils.handleNotificationOpened(BrazeNotificationUtils.kt:115)
                                                                                                        at com.braze.push.BrazePushReceiver$Companion.handlePush$performWork(BrazePushReceiver.kt:118)
                                                                                                        at com.braze.push.BrazePushReceiver$Companion.handlePush(BrazePushReceiver.kt:127)
                                                                                                        at com.braze.push.BrazePushReceiver$Companion.access$handlePush(BrazePushReceiver.kt:45)
                                                                                                        at com.braze.push.BrazePushReceiver$Companion$handleReceivedIntent$1.invokeSuspend(BrazePushReceiver.kt:142)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                                                                                                        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Additional Information

No response

bryanlogan commented 2 years ago

Thanks for bringing this up. We'll look into it.

radixdev commented 1 year ago

Hi @iNdieboyjeff ,

We're having difficulties reproducing the issue.

  1. Can you provide your AndroidManifest.xml file?
  2. Can you verify whether your app is using "Android Leanback"?
  3. What is the output of context.packageManager.getLaunchIntentForPackage(context.packageName)?
  4. What is the output of context.packageManager.getLeanbackLaunchIntentForPackage(context.packageName)?