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

fixes crash on Android re-enter app #1001

Closed
wants to merge 1 commit into from
Closed

Conversation

cpetzel
Copy link
Contributor

@cpetzel cpetzel commented Jan 27, 2018

#999 #925

The RCTMGLMapView has a LocationLayer that is registered with the locationEngine, and it never got removed when the view was torn down. This will tell the LocationLayer to stop when the view is detached.

However, the Lost Engine is still active in the background. This patch simply lets you press back to close the app, and then re-enter without a crash

nitaliano#999

The MapView has a locationPlugin that is registered with the locationEngine, and it never got removed when the view was torn down. This will tell the LocationPlugin to stop when the view is detached. 

However, the Lost Engine is still active in the background. This patch simply lets you press back to close the app, and then re-enter without a crash
@cpetzel
Copy link
Contributor Author

cpetzel commented Jan 27, 2018

@nitaliano This seems to fix the crash in our app, but the LocationEngine is still active when the app is backgrounded (or the MainActivity is destroyed).

With this change, you can successfully kill the activity and reenter. No more DeadObjectException.

@nitaliano
Copy link
Owner

Awesome! I'll test this out. It might still be active in the background due to the telemetry service also using it.

@Override
public void onViewAttachedToWindow(View v) {
if(mLocationLayer != null){
mLocationLayer.onStart();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nitaliano might want to wrap this onStart call with the same logic in setReactShowUserLocation()

setReactShowUserLocation(mShowUserLocation)

@henrikra
Copy link
Contributor

We tried your branch and we still got the crash :/

@cpetzel
Copy link
Contributor Author

cpetzel commented Jan 30, 2018

closing this in favor of #1010

@cpetzel cpetzel closed this Jan 30, 2018
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.

3 participants