我遇到PushNotifications问题。当我收到应用程序是否打开的通知时,我正在处理。但是当应用程序打开时,我想显示一个横幅,就像推送通知一样,但我不知道如何提示?
我在Visual Studio for Mac 7.2中使用MVVMCROSS 5.3
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
if (userInfo != null)
{
ProcessNotification(userInfo, false, application);
}
}
...
public void ProcessNotification(NSDictionary options, bool fromFinishedLaunching, UIApplication application)
{
//Verificando se o App está e, primeiro plano para criar a notificação
if (!fromFinishedLaunching)
{
// Check to see if the dictionary has the aps key. This is the notification payload you would have sent
if (null != options && options.ContainsKey(new NSString("aps")))
{
//Get the aps dictionary
NSDictionary aps = options.ObjectForKey(new NSString("aps")) as NSDictionary;
NSDictionary alertString = new NSDictionary();
string paramString = string.Empty;
string body = string.Empty;
string title = string.Empty;
if (aps.ContainsKey(new NSString("alert")))
{
//Taking values to create the banner
alertString = aps.ObjectForKey(new NSString("alert")) as NSDictionary;
body = (alertString[new NSString("body")] as NSString).ToString();
title = (alertString[new NSString("title")] as NSString).ToString();
**//Creating a banner like PushNotification
//?
//?
//?**
}
}
}
else
{
string idOrder = (options[new NSString("idOrder")] as NSString).ToString();
if (idOrder != null)
{
var orderService = Mvx.Resolve<IOrderService>();
var order = orderService.searchOrder();
if (order.Result.status == "E")
{
//Show my View
}
}
}