Skip to content
Sona makes possible using getui push on flutter.Flutter版个推SDK。
Branch: master
Clone or download
Latest commit 8475534 May 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android update gradle&kotlin May 13, 2019
arts add logo Sep 14, 2018
example update demo May 13, 2019
ios add setBadge (iOS only) Apr 17, 2019
lib add setBadge (iOS only) Apr 17, 2019
.gitignore
CHANGELOG.md bump to 0.9.2 Apr 22, 2019
LICENSE Initial commit Sep 7, 2018
README.md udpate readme Feb 11, 2019
pubspec.yaml bump to 0.9.2 Apr 22, 2019

README.md

logo pub package

sona makes possible using getui push in flutter.

简介

Sona是个推推送SDK在Flutter上的实现。通过Sona,可以在Flutter上轻松使用个推推送。 使用Sona之前,请到个推官网进行应用注册。

初始化

鉴于AndroidiOS的差异化,对应平台设置还需手动设置,具体请参考官网。 在Flutter中通过Sona初使化个推推送:

    import 'package:sona/sona.dart' as sona;
    sona.register(
        appID: "your app id",
        appKey: "your app key",
        appSecret: "app secret"
    );

appIDappKeyappSecret目前仅在iOS上生效,因为在android上,这些配置是在build.gradle中完成的,所以使用Sona之前 一定要在android工程配置appIDappKey以及appSecret

defaultConfig {
        //some configrations

        manifestPlaceholders = [
                GETUI_APP_ID : "APP_ID",
                GETUI_APP_KEY : "APP_KEY",
                GETUI_APP_SECRET : "APP_SECRET"
        ]
    }

接收透传

通过监听receivedMessageData可以获取个推推送的透传数据:

   sona.receivedMessageData.listen((payload){
      //接收到透传
      });

其中payloadMap<dynamic,dynamic>根据平台不台,其包含的key也不同:

  • appID:String
  • taskID:String
  • messageID:String
  • offLine:bool
  • payload:String or null
  • pkgName:String,仅安卓平台
You can’t perform that action at this time.