Apple Notification Class似乎不具有徽章和声音的属性:
是否还有其他类可以生成带有声音和徽章的iOS有效负载。我知道我可以通过制作字符串来手动完成此操作,但更喜欢使用创建的类。
例如,这是不希望的:
var alert = "{\"aps\":{\"alert\":\"" + pushNotificationMessage + "\",\"badge\":<input1>,\"sound\": <input2>"}}";
这样会更好:
microsoftDefinedMethod( message = null, badge = false, sound = false);
您可以使用SendAppleNativeNotificationAsync方法(或其重载之一):
public Task<NotificationOutcome> SendAppleNativeNotificationAsync(string jsonPayload)
该jsonPayload
参数是本地iOS有效负载。这是官方文档中的一个示例,看起来像您想要实现的目标:
{
"aps" : {
"alert" : "You got your emails.",
"badge" : 9,
"sound" : "bingbong.aiff"
},
"acme1" : "bar",
"acme2" : 42
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句