如何在Xamarin表单中执行推送通知 [英] How to do Push Notification in Xamarin Forms

查看:397
本文介绍了如何在Xamarin表单中执行推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理Xamarin表格.我一直在寻找Xamarin表单中的Push通知,有人说Xamarin表单没有这样的实现,但是有Xamarin.iOS和Xamarin.Android.我是新手,我可能会想念与此主题有关的许多发展新闻.

I am working on Xamarin forms. I had been searching for Push notification in Xamarin forms, some said there is no such implementation for Xamarin forms but there are Xamarin.iOS and Xamarin.Android. I am a newbie I may miss many development news on this subject.

我想知道:

I would like to know:

1)Xamarin推送通知表单有最新开发吗?
2)是否有任何示例应用程序可供学习,有关xamarin形式的任何教程?
3)构建此类应用程序有哪些要求,需要哪些SDK或工具.

1) Is there any latest development for Xamarin forms for Push Notification?
2) Any sample app to learn from , any tutorial for xamarin form?
3) What are requirements to build this kind of app, what SDK or tools required.

请帮助

推荐答案

推送通知对每个平台的要求略有不同.您将需要为要在Xamarin.Forms应用程序中定位的每个平台编写平台特定的代码.

Push Notifications have slightly different requirements for each platform. You will need to write platform specific code for each of the platforms you wish to target in your Xamarin.Forms App.

实现此目标的最佳方法是使用DependencyService. Xamarin.Forms 指南.

The best way to achieve this is with a DependencyService. There is a great overview of how to do this with a number of examples in the Xamarin.Forms guides.

不幸的是,其中一个示例不适用于推送通知".但是,有一个很棒的(免费)本书,其中包含大量有用的演练和Xamarin.Forms示例,其中包括关于Push Notifications的第(5)章.有适用于Android,iOS和Windows的代码食谱,应可为您提供所需的内容.

Unfortunately one of the examples is not for Push Notifications. However, there is a great (free) book that contains loads of useful walkthroughs and examples for Xamarin.Forms including a chapter (5) on Push Notifications. There are code recipes for Android, iOS and Windows which should provide you with what you need.

对于SDK/工具,我建议使用 Azure通知中心,可以将其与每个主要平台通知服务集成:

For SDKs/tools I would recommend using an Azure Notification Hub, this can be integrated with each of the major platforms notifications services:

  • 适用于iOS的APNS
  • Android版Firebase
  • Windows的WNS

配置完成后,您可以将相同的通知发送给多个用户,而不必担心他们位于哪个平台上.

Once configured, this will allow you to send the same notifications to multiple users without worrying which platform they are on.

这篇关于如何在Xamarin表单中执行推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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