问题描述
我注意到可以将Firebase用于推送通知功能.但是我的项目需要使用OneSignal.有可能在Flutter中实现它吗?我找不到任何相关文章或文章.
I notice that I can use Firebase for push notification feature. But my project requires using OneSignal. Is it possible to achieve it in Flutter? I can't find any post nor article talking about that.
谢谢.
推荐答案
OneSignal现在有一个官方插件 https://github.com/OneSignal/OneSignal-Flutter-SDK
There is an official plugin now for OneSignalhttps://github.com/OneSignal/OneSignal-Flutter-SDK
不幸的是,没有用于Flutter的插件可以使用OneSignal.不过,您可以自己写一个.
Unfortunately, there is no plugin for flutter to use OneSignal. You can write one yourself, though.
由于OneSignal适用于iOS和Android,因此您要做的是编写Flutter与各自平台之间的通信.
Since OneSignal exists for iOS and Android, what you have to do is write a communication between flutter and respective platforms.
如果您决定自己实现这些功能,那么即使纯平台渠道也是可行的
If you decide to just implement the features for yourself, even pure platform channels can be viable.
Flutter插件只是一个包装程序,用于将平台依赖的平台通道的使用提取到库中.
Flutter plugin is just a wrapper to extract usage of platform channel that are platform dependent into a library.
如果您正在使用IntelliJ,则从新项目上的插件模板开始后,在工具"->"Flutter"中,您可以选择在Xcode/Android Studio中打开本机iOS/Android代码.这应该有助于启动工作.
IF you are using IntelliJ, after starting with plugin template on new project, in Tools -> Flutter you have an option to open the native iOS/Android code in Xcode/Android Studio. That should help to start things up.
这篇关于在Flutter中使用OneSignal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!