Using OneSignal with Flutter

强颜欢笑 提交于 2019-12-22 14:04:11

问题


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.

Thanks.


回答1:


EDIT:

There is an official plugin now for OneSignal https://github.com/OneSignal/OneSignal-Flutter-SDK


Unfortunately, there is no plugin for flutter to use OneSignal. You can write one yourself, though.

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 plugin is just a wrapper to extract usage of platform channel that are platform dependent into a library.

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.




回答2:


There is an official Flutter package!

Add it as a dependency to your pubspec.yaml file:

dependencies:
  onesignal: ^1.1.0  # Verify that this is the latest version

Full setup instructions can be found here.



来源:https://stackoverflow.com/questions/50551863/using-onesignal-with-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!