MonoTouch Notify once a web link has been loaded by UIApplication.SharedApplication.OpenUrl

436 Views Asked by At

I've had a look around to try and work out how I can receive a notification for when a URL has been loaded by the shared application, and it appears I need to create a delegate which inherits from UIApplicationDelegate and override some of the methods, however I can't seem to work out which methods to override and how I would implement them?

1

There are 1 best solutions below

8
On BEST ANSWER

Your application already have a delegate that inherits from UIApplicationDelegate. That's generally inside the (MonoDevelop generated) AppDelegate.cs file and where the required FinishedLaunching method is present.

I'm not 100% sure what you want exactly want to accomplish (any reference?) but you can override the local and remote notification, e.g.

public override void ReceivedLocalNotification (UIApplication application, UILocalNotification notification)
{
    // ...
}

public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo)
{
    // ...
}

but if you want to know if an URL was provided when opening your application then this should be done inside the (already overridden) FinishedLaunching method. That last part, to use to supplied information inside the NSDictionary, is explained in Apple documentation.