Skip to content

tgarm/sona

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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,仅安卓平台

About

Sona makes possible using getui push on flutter.Flutter版个推SDK。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 42.1%
  • Kotlin 25.6%
  • Dart 25.1%
  • Ruby 7.2%