Closed RHMDHDYT closed 5 years ago
Hi RHMDHDYT,
Thanks for the detailed issue report. This issue may take some extra time to investigate as it's about a potential interaction with an external library and service. We'll update this issue as soon as we know more.
I have followed the steps to reproduce, but have not been able to observe the issue reported.
Steps I took:
In order to help us reproduce this issue could you answer the following questions?
Thank you for your assistance in tracking down this issue.
Hi @gwhelanLD
here i upload a sample project to help you tracing the issue. https://github.com/RHMDHDYT/SampleApp
I appreciate the prompt answers to my questions and the very helpful sample project for replication. I have been able to reproduce the issue and will update you as soon as I know more about the root cause.
Thanks.
The cause of your issue seems to be the line
ldClient = LDClient.init(this, ldConfig, user, 0)
in CustomApplication.kt
. I believe the intent was to not wait for completion of the client initialization before continuing, however LDClient.init
with a startWaitSeconds
of zero actually indicates to wait until completion. When an application is started to respond to a broadcast intent, it is given a very short period of time to initialize. Additionally, the completion of the init
future may be delayed as the SDK will detect that it has been started in the background. This causes the application to trigger an ANR
before it can handle the notification intent.
To trigger an init
without waiting for completion try the following:
LDClient.init(this, ldConfig, user)
ldClient = LDClient.get()
In my testing this prevents the ANR issue, and push notifications when the application has been stopped work correctly. Let me know if this solves the issue for you.
Thanks again for the issue report and helpful sample project.
Yes it solve my issue. by init the LDClient using your way or adding startWaitSeconds
in 5 second now the notification working properly.
Many thanks @gwhelanLD
Description: So, i'm using onesignal for notification and launchdarkly for feature flagging in my app. And i found that when the app closed (by swiping from recent apps) the device can't get notification. Another scenario like receiving notification when the app is active and receiving notification when the app in the stand by mode (pressing back button) is working fine.
In logcat i see that the notification was delivered to the device but canceled.
2019-05-14 12:02:02.405 21243-21243/? W/GCM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=id.qasir.mitra.staging (has extras) }
After tracing the code and removing some dependencies that may contains notification services / broadcast receiver, i found that the problem is from launchdarkly. I'm still learning launchdarkly source code and not yet find the issue.
To make sure that "notification not shown issue" is not from the OS, i'm trying the OneSignal example app and its working fine in same device.
So, my temporary solution right now is by removing launchdarkly from my app and replacing the feature flag with firebase remote config. Both library (Onesignal and LaunchDarkly) are important to me and can't replaced with other libraries.
Any help will be appreciated.
Environment
Android Compile SDK Version: 28 Build Tools Version: 28.0.3 Kotlin Version: 1.3.31 OneSignal Gradle plugin: [0.12.1, 0.99.99] OneSignal library: 3.10.8 Launchdarkly: 2.8.0
Device testing:
Steps to Reproduce Issue: