如何在 xamarin android 上进行抬头通知? [英] How to do headsup notification on xamarin android?

查看:59
本文介绍了如何在 xamarin android 上进行抬头通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Xamarin Android 上将通知显示为抬头通知.我收到了通知,但我不知道如何设置为高优先级,以便即使在使用其他应用程序时也能显示.我为 NuGet 使用了插件 Xam.Plugin.Notifier.

How can I show the notification as heads up notification on Xamarin Android. I got the notification working, but I don't know how to set to high priority so it can show up even when using other application. I used the plugin Xam.Plugin.Notifier for the NuGet.

推荐答案

在 Xamarin.Android 中,如果要显示提醒通知,则必须将优先级设置为 High 或 Max:builder.SetPriority (NotificationPriority.High);根据 Notifier 插件的来源,没有用户设置优先级的接口,所以不支持抬头通知.如果你真的想使用它,我可以为你推荐两种解决方案:

In Xamarin.Android, if you want to show heads-up notification, you have to set the priority to High or Max: builder.SetPriority (NotificationPriority.High); According to the source of Notifier plugin, there is no interface for the user to set the priority, so it does not support heads up notification. If you really want to use it, I can suggest 2 solutions for you:

1) 向 Notifier Plugin 的作者提交 issue 修改它以支持抬头通知.

1) Post an issue to the author of Notifier Plugin to modify it to support heads-up notification.

2) 自己在 Xamarin.Android 中创建通知,而不是使用插件.在你的代码中,你可以这样写:

2) Create a notification yourself in Xamarin.Android instead of using the plugin. And in your code, you can write this:

builder.SetPriority (NotificationPriority.High);

builder.SetPriority (NotificationPriority.Max);

这篇关于如何在 xamarin android 上进行抬头通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆