NAXAM / mapbox-android-binding

Xamarin binding for MapBox Android SDK
Other
24 stars 15 forks source link

App does not restart after closing it #11

Closed Niach closed 1 year ago

Niach commented 6 years ago

If you swipe the app away in the recent apps, you cannot start the app again and it is stuck in the splashscreen. I think maybe the mapbox service is not closed and prevents the mainactivity to start again. This behaviour also occures in the sample app.

mdenkmaier commented 6 years ago

Same on my side, cannot start the app again after closing it. You can check it using your own sample application.

tuyen-vuduc commented 6 years ago

How do you guys say closing it? It works well at my end. (open <=> close)

cschwengler commented 6 years ago

Same, swipe the app away out of the recent apps(no explicit killing) and open it again -> infinite loop

Niach commented 6 years ago

I'm using it in a Fragment and did it like in your blog post:

public override void OnDestroyView()
        {
            mapView?.RemoveOnMapChangedListener(this);
            mapView?.OnDestroy();
            base.OnDestroyView();
        }
tuyen-vuduc commented 6 years ago

@cschwengler On which device did you face the issue?

@Niach Have you faced the same issue on my sample?

Plz check device log where there are a lot of details for us to investigate deeper.

I didn't face any issues when closing app/opening app on simulator.

Cheers.

cschwengler commented 6 years ago

On a Oneplus 3 with Oxygen OS, Android 8.0

tuyen-vuduc commented 6 years ago

Hey,

I couldn't replicate your issue without more details.

Plz connect device and try to debug then get the logcat details.

Thanks.

cschwengler commented 6 years ago

Hey, i found whats going wrong. Its happening if you enabled the Mapbox TelemetryService. Maybe you disabled it on your testing device. If its enabled and you try to restart the app, it hangs.

Niach commented 6 years ago

I made a video of your sample app: https://www.youtube.com/watch?v=AZg2D2dGa7U After force-killing the app it works again, and if you disagree with the telemetry service it also works.

Niach commented 6 years ago

I think this is the problem: https://github.com/mapbox/react-native-mapbox-gl/issues/878 https://github.com/mapbox/react-native-mapbox-gl/issues/906 https://github.com/mapbox/react-native-mapbox-gl/issues/1023 Should got fixed with Mapbox 6.1.0

Niach commented 6 years ago

The problem seems to appear only on your xamain.forms sample and not in your android sample app. Maybe it has something to do with the Fragment?

tuyen-vuduc commented 6 years ago

Plz check back v6.4 now.

tmatrai commented 6 years ago

Hi Guys,

I have just tested v6.4, and the bug still exists. Start app (OK), close it by pressing device back button (app closes), click on the app icon again (BUG: app freezes). It happens by Xamarin Forms. Tested on Samsung Galaxy A5, Android 8.0.0.

tmatrai commented 6 years ago

After investigating this bug I found that calling Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); in maprenderer after fragment = null; in dispose method it "solves" the problem, the app can be re-started successfully. I don't feel it a bugfix of course, it seems a brutal "solution", but hopefully can lead to the fix by pointing out it can be some lifecycle / fragment dispose related problem.

tmatrai commented 6 years ago

When you open app by tapping a push message on Android, app start also hangs if there is a MapBox map on the start page of the app. In this case it does not matter how you closed it before, so a simple home button pressing close also can lead to this error. Samsung Galaxy A5, Android 8.0.0.

stephenmante commented 6 years ago

App freezes due to fragment dispose related problem. This issue occur in Xamarin Forms. I tried not using fragment and follow the same approach like what amay077 did in Xamarin.Forms.GoogleMaps in creating the view that can be found in this link https://github.com/amay077/Xamarin.Forms.GoogleMaps/blob/master/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/MapRenderer.cs#L119 and it solves the problem.