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

Fix #953 - Call ES init prior to the initialization of ES Fragments #954

Merged
merged 2 commits into from
Dec 19, 2018

Conversation

barbeau
Copy link
Member

@barbeau barbeau commented Dec 18, 2018

This is a workaround to make sure ES SDK is initialized in case we startup to ES Fragments. The previous workaround that listens for an onStart() event from an application-wide ProcessLifecycleOwner Observer doesn't happen earlier enough in the Fragment lifecycle and results in an NPE. This patches ensures that when starting HomeActivity, which could start up directly to showing an ES fragment, we call ES init before initializing the fragment being shown to the user.

When ES SDK no longer runs servers in the background Application.setUpSocial() can be made private again and all ES SDK initialization can happen in Application.onCreate().

@acrown-msft Could you please review and see if this fixes #953, and also doesn't cause any problems with running an ES service in the background?

This is a workaround to make sure ES SDK is initialized in case we startup to ES Fragments.  The previous workaround that listens for an onStart() event from an application-wide ProcessLifecycleOwner Observer doesn't happen earlier enough in the Fragment lifecycle and results in an NPE.  This patches ensures that when starting HomeActivity, which could start up directly to showing an ES fragment, we call ES init before initializing the fragment being shown to the user.

When ES SDK no longer runs servers in the background Application.setUpSocial() can be made private again and all ES SDK initialization can happen in Application.onCreate()
@barbeau barbeau requested a review from acrown-msft December 18, 2018 23:30
Copy link
Contributor

@acrown-msft acrown-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move Application.get().setUpSocial(); so that it is executed before setContentView(R.layout.main);

@barbeau barbeau merged commit 1f4a362 into master Dec 19, 2018
@barbeau barbeau deleted the es-init-home-activity branch December 19, 2018 14:29
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

Successfully merging this pull request may close these issues.

Crash when opening app to Embedded Social fragment
2 participants