MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

Fix bug when Android does auto memory management. #191

Closed GMCristiano closed 8 years ago

GMCristiano commented 8 years ago

This was tested with Android 5.0.2, 1G of Ram and the bug was forced scrolling down Facebook and Chrome Apps for some seconds until Android does some memory management.

MvxAppCompatActivity probably needs this too.

vvolkgang commented 8 years ago

I've received some random crashes that might be related to this. It implies that the SplashScreen isn't running when Android resumes an app from a saved state, and that the current activity probably lost it's MvxActivityAdapter, which seems to be responsible for re-running this sort of code.

thefex commented 8 years ago

Assumption that Splash screen will be always invoked is unfortunately wrong. Android application life-cycle model is really complex.

  1. If application crash and application is reopened Splash Screen might not be called -> App crash one more time;) This PR fixes that for AppCompatActivity.
  2. If application is run from Service (let it be Push Handler) SplashScreen won't be called - and dependent on service logic it might crash (even after this PR).
GMCristiano commented 8 years ago

thx for the feedback guys,

  1. i dont have much time rigth now but if no one gets into this, i will try to go deep on the solution to work with any Activity.

2.Its truth. And with a push handle service is the exact same solution.

    protected override void OnMessage(Context context, Intent intent)
    {
        var setup = MvxAndroidSetupSingleton.EnsureSingletonAvailable(context);
        setup.EnsureInitialized();
vvolkgang commented 8 years ago

Nice info fex, didn't had the time to dig into that double crash problem.

I believe we can solve those problems by adding the EnsureInit to all mvx Activity classes and create base mvx service classes that handle that too. On Wed, 23 Mar 2016 at 22:22, GMCristiano notifications@github.com wrote:

thx for the feedback guys,

  1. i dont have much time rigth now but if no one gets into this, i will try to go deep on the solution to work with any Activity.

2.Its truth. And with a push handle service is the exact same solution.

protected override void OnMessage(Context context, Intent intent)
{
    var setup = MvxAndroidSetupSingleton.EnsureSingletonAvailable(context);
    setup.EnsureInitialized();

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/MvvmCross/MvvmCross-AndroidSupport/pull/191#issuecomment-200566854

Regards,

Álison Fernandes