【发布时间】:2016-02-24 07:52:16
【问题描述】:
我一直在按照以下位置的教程进行操作:https://azure.microsoft.com/en-us/documentation/articles/partner-xamarin-mobile-services-xamarin-forms-get-started-push/ 尝试获取推送通知以在我的 Xamarin.Forms 应用程序中工作。
我已经让他们在 Android 上运行,但我在 iOS 上遇到了一个错误 - 我需要在实际发出通知之前自定义文本(来自手机),但我不能在 ios 上运行,因为应用在后台运行,没有调用 ReceivedRemoteNotification。
这与我的通知处理代码类似:
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
NSObject inAppMessage;
bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage);
if (success)
{
//change the text that is displayed
string newNotText = ModifyNotification(inAppMessage.ToString());
var alert = new UIAlertView("Got push notification", newNotText, null, "OK", null);
alert.Show();
}
}
如何自定义在 iOS 上收到的通知?
【问题讨论】:
标签: ios background xamarin push-notification xamarin.forms