Forum Xamarin.Forms

Want to change Content Page Application goes on OnSleeep Mode for iOS and Android

BipsBips INMember

Hello Guys,

I Want set one default image application main screen when my application goes in Background (OnSleep Mode) for iOS and android using xamarin.Forms.

           public Page myPage;
    protected override async void OnSleep ()
        myPage = App.Current.MainPage;
        Device.BeginInvokeOnMainThread (() => {
            App.Current.MainPage = new NavigationPage(new BaseClass()); 

        System.Diagnostics.Debug.WriteLine ("Sleep");

    protected override void OnResume ()
        App.Current.MainPage = myPage;
        System.Diagnostics.Debug.WriteLine ("Resume");

I'm trying with above code and it's working fine in iOS but not working for Android.
Please suggest some solution for Android.


Best Answer


Sign In or Register to comment.