Forum Xamarin.Mac
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to bring Xamrin MAC app to foreground programmatically?

vivek00712vivek00712 Member ✭✭
edited April 30 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.ScheduleNotification(notification);


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

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

Thank you in advance,
Vivek

Answers

Sign In or Register to comment.