Forum Xamarin.Mac


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to bring Xamrin MAC app to foreground programmatically?

vivek00712vivek00712 Member ✭✭
edited April 2020 in Xamarin.Mac

Hello Team,

How to bring Xamarin MACapp to foreground programmatically, by clicking on the local notification. How can I achieve it? I have written below code for the local notification. On clicking on that local notification I want to foreground my app.

NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;

 NSUserNotification notification = new NSUserNotification();
        notification.Title = title;
        notification.Subtitle = content;
        notification.InformativeText = "TEST";
        notification.SoundName = NSUserNotification.NSUserNotificationDefaultSoundName;
        notification.DeliveryDate = NSDate.FromTimeIntervalSinceNow(1);           


        center.DidDeliverNotification += (s, e) =>
            Console.WriteLine("Notification Delivered");              

        center.DidActivateNotification += (s, e) =>
            Console.WriteLine("Notification Touched");                

Thank you in advance,


Sign In or Register to comment.