//when you app in background and user click your notification
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
Window = new UIWindow(UIScreen.MainScreen.Bounds);
var userInfo = launchOptions.ValueForKey(UIApplication.LaunchOptionsRemoteNotificationKey) as NSDictionary;
if (userInfo != null)
{
var message = userInfo.ValueForKey(new NSString("yourTextKey")) as NSString;
var vc = new MessageViewController();
vc.TextView.Text = message;
Window.RootViewController = vc;
}
else
{
Window.RootViewController = new OtherRootViewController();
}
Window.MakeKeyAndVisible();
return true;
}
//when you app in foreground
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
if (userInfo != null)
{
var message = userInfo.ValueForKey(new NSString("yourTextKey")) as NSString;
var vc = new MessageViewController();
vc.TextView.Text = message;
Window.RootViewController.PresentViewController(vc, true, null);
}
}
であります