Bug 28659 - [Android] Forms OnResume() method does not always reflect the expected Android Lifecycle OnResume() method.
Summary: [Android] Forms OnResume() method does not always reflect the expected Androi...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.0
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-01 15:12 UTC by Jon Douglas [MSFT]
Modified: 2016-08-09 13:48 UTC (History)
7 users (show)

Tags: android functional
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jon Douglas [MSFT] 2015-04-01 15:12:00 UTC
*Description

Currently as of Xamarin.Forms 1.3, we have lifecycle methods such as OnStart(), OnSleep(), and OnResume(). These methods however do not fully translate within Android's Lifecycle and thus can cause some unexpected behavior.

Given the scenario:

1) User starts application for the first time - Application should go into an OnStart().

2) User hits the home button - Application should go into an OnSleep().

3) User returns back to the application - Application should go into an OnResume().

Currently when following 2) -> 3), OnResume does not seem to be called as expected in the lifecycle. Using Android's native OnResume(), it is observed that it is called appropriately when returning to an application.

I've seen a few different scenarios with the Xamarin.Forms OnResume() method:

1) OnResume() is not called at all. (Typically on a physical device)

2) OnResume() is called multiple times. (Seen on emulators mainly)

This seems to differ on device and emulator however.

Given the workflow on a physical Motorola 6 with API 22:

1) OnStart()
2) Hit Home
3) OnSleep()
4) Return to Application
5) OnResume()
6) OnResume()

Although this is close to mimicking the lifecycle of Android, it still is calling OnResume() twice for some reason.

*Xamarin.Forms Version
1.4.X
Comment 1 Yuri 2015-04-01 18:09:39 UTC
Besides what mentioned in this description it's not just calls to OnResume. When I run my app on Sony XPeria after pressing home button and coming back I see my first root screen, I don't return to the last screen I was on. It is like my app just started again. The events are actually appropriate to that scenario - I get OnStart instead of OnResume. This makes my Forms app not usable at all.
Comment 2 Rui Marinho 2016-08-09 13:48:34 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.

For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team