This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 40722 - Using FormsAppCompatActivity calls OnDisappearing on device sleep
Summary: Using FormsAppCompatActivity calls OnDisappearing on device sleep
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-27 00:20 UTC by Joshua Novak
Modified: 2016-12-01 13:25 UTC (History)
8 users (show)

See Also:
Tags: Android ac
Is this bug a regression?: ---
Last known good build:


Attachments

Description Joshua Novak 2016-04-27 00:20:16 UTC
When you add FormsAppCompatActivity the OnDisappearing method is called when the device sleeps, but OnAppearing is not called on device resume. If you use the normal FormsApplicationActivity OnDisappearing is not called when the device sleeps, which is how it should be.

Here is a Google Drive link to an example project. If you just run the project, click page 3, then watch the debug log. When you sleep the device you'll see the message "ON DISAPPEARING!!!", this should only happen when you leave the page.

https://drive.google.com/file/d/0B68aZqcn2sxXSWY0aWpHVGZfYU0/view?usp=sharing

Note: This is a huge issue since it breaks any app using FormsAppCompatActivity. Please fix as soon as possible. I have to delay my app because of this.
Comment 1 E.Z. Hart 2016-05-02 20:59:25 UTC
Confirmed - the behavior is not consistent between FormsApplicationActivity and FormsAppCompatActivity.
Comment 2 Joshua Novak 2016-05-02 22:26:33 UTC
This seems to be fixed in Xamarin.Forms 2.2
Comment 3 Björn Bentmar 2016-05-25 11:19:37 UTC
In XF 2.2 The OnAppering/Dissapearing is extremely broken. Every page in you navigation stack will trigger onappering when coming back from background. And every page will also trigger dissapearing when entering background, Or changing activity (for example taking picture with Xam.Plugin.Media)..
Comment 5 Samantha Houts 2016-10-12 22:07:52 UTC
Should be fixed in 2.3.4-pre1. Please note that you will need to opt in to the fix. 

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat;

...

Application.Current.On<Android>()
                            .SendDisappearingEventOnPause(false)
                            .SendAppearingEventOnResume(false);


See https://github.com/xamarin/Xamarin.Forms/pull/450 for details. Thank you!

Note You need to log in before you can comment on or make changes to this bug.