-
Notifications
You must be signed in to change notification settings - Fork 303
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
Occasional Embedded Social SDK crash after updating to target Android 8.0 (API level 26) #933
Comments
Here's another occurrence - if you long press the home screen icon, you'll get this stack trace (EDIT - this isn't always reproducible?):
|
One workaround solution for now would be to check if the Application code is running in the background before initializing ES - for example: We can use the LifecycleOwner to get Lifecycle.getCurrentState() |
@acrown-msft is working on a new release of the ES SDK that, IIRC, does lazy initialization of some items, which would avoid these background execution issues. We can test after updating the ES SDK to see if these issues still pop up. |
Unfortunately the ES SDK bump didn't seem to solve the crash when moving the icon on the home screen. Reopening... |
For future purposes - looks like WorkManager is the best long-term solution for ES SDK. As a short-term workaround I'm going to try checking to see if the app is running in the background via LifecycleOwner before initializing the ES SDK in our |
@acrown-msft I think I may have figured out a way to consistently reproduce this:
Here's what I think is happening:
@acrown-msft Do you think you could mitigate this issue by returning https://developer.android.com/reference/android/app/Service#START_NOT_STICKY This way if the ES Service crashes, it won't be launched again unless it's explicitly started by the OBA app code, so we won't get into the infinite crash loop. |
To hopefully avoid starting the ES Services in the background at all, I'm moving initialization of ES SDK into a callback that only executes when the app comes into the foreground - implementation in #940. |
And, @acrown-msft just implemented the use of |
* onStart() gets called for each Activity start, which can execute the init more than once in the App lifecycle. This patch changes to a synchronized method with a boolean flag to ensure ES is only initialized once in the Application lifecycle
Summary:
First mentioned in #930 (comment).
After bumping to
targetSdkVersion 26
, when restarting the app from Android Studio I'm seeing this relatively frequently:This crash is related to background executions limits introduced on Oreo:
https://developer.android.com/about/versions/oreo/background
Steps to reproduce:
or
@acrown-msft is investigating to see if this occurs in other direct user-facing cases
Expected behavior:
Not crash
Observed behavior:
Crash
Device and Android version:
Samsung Galaxy S8+ w/ Android 8.0
The text was updated successfully, but these errors were encountered: