Search code examples
iosxamarinxamarin.iosnsnotificationcenter

How to, applicationDidBecomeActive in Xamarin iOS?


How do I do this in Xamarin iOS?

ViewDidAppear is not called when opening app from background

The link below mentions the OnActivated method for Xamarin in the AppDelegate, but how do I subscribe my ViewController so it knows when the app comes from the background?

https://forums.xamarin.com/discussion/10594/where-is-applicationdidbecomeactive-in-xamarin-ios


Solution

  •     NSObject notificationObserver = NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.DidBecomeActiveNotification, DoStuff);
    
        private void DoStuff (NSNotification a_notification)
        {
            // DO STUFF HERE
        }