Coder Social home page Coder Social logo

openflutter / sona Goto Github PK

View Code? Open in Web Editor NEW
35.0 5.0 7.0 189 KB

@Deprecated Not maintained. Developers who need Getui push please visit official plugins

License: Other

Kotlin 25.64% Ruby 7.18% Objective-C 42.13% Dart 25.04%
getui-push flutter-getui-push

sona's Introduction

logo pub package

sona makes possible using getui push in flutter.

@Deprecated

This lib won't be updated.Devleopers should visit the official flutter plugin for help.

简介

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

sona's People

Contributors

jarvanmo avatar rockerflower avatar tgarm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sona's Issues

安卓构建报错

sona版本0.02;
flutter版本0.10.0
安卓构建时报:
SonaPlugin.kt: (65, 33): Type inference failed. Expected type mismatch: inferred type is String? but String was expected

deviceToken broken on iOS

使用example项目,发现无法推送到iOS设备。
经调试,发现SonaPlugin.m中的didRegisterForRemoteNotificationsWithDeviceToken函数未被调用。将函数复制到项目的AppDelegate.m后问题解决。

最终添加一行代码解决了此问题:
在SonaPlugin.m第18行添加:
[registrar addApplicationDelegate:instance];
即可解决此问题。

Android安装失败 自定义权限问题

如果有一个app用了sona, 其他app安装会失败.
应该是manifest中自定义权限的名字的原因吧

<permission android:protectionLevel="normal" android:name="com.jarvanmo.sona.service.SonaPushService"/>

Failure[INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.jarvanmo.sona.service.SonaPushService pkg=com.xxx.xxx]

小米6上面接收不了推送

小米6上面收不到推送,各种设置都已经打开,但是还是不行,其他手机没问题,Android 版本 8.0

会出现不影响功能的异常

在MAC的手机模拟器启动应用后会出现异常,目前只打包成apk测试没问题,IOS还没证书不能测试不知道有没影响

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method registerGeTui on channel com.jarvanmo/sona)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)

#1 register (package:sona/src/sona_iml.dart:28:25)

#2 register (package:flutter_app/main.dart:50:3)
#3 main (package:flutter_app/main.dart:38:3)
#4 _runMainZoned.. (dart:ui/hooks.dart:199:25)
#5 _rootRun (dart:async/zone.dart:1124:13)
#6 _CustomZone.run (dart:async/zone.dart:1021:19)
#7 _runZoned (dart:async/zone.dart:1516:10)
#8 runZoned (dart:async/zone.dart:1500:12)
#9 _runMainZoned. (dart:ui/hooks.dart:190:5)
#10 _startIsolate. (dart:isolate-patch/isolate_patch.dart:300:19)
#11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

通知栏点击动作

我将app隐藏到后台,(没有完全被杀死),当我收到消息时,点击通知栏,发现不会打开app页面,但是日志会显示收到消息,请问这是要哪里设置一下的

android端收不到推送

flutter环境如下:
Flutter 1.5.9-pre.177 • channel master • https://github.com/flutter/flutter.git
Framework • revision 91aa36b7bd (2 days ago) • 2019-05-08 03:03:39 -0400
Engine • revision 436a3c70a9
Tools • Dart 2.3.0 (build 2.3.0-dev.0.5 8143450941)

排查下来发现MethodChannel的invokeMethod方法必须在UI线程中执行

methodChannel?.invokeMethod("onReceiveMessageData", result)

麻烦确认下

xcode 构建错误

你好,我集成sona 0.0.9后,出现xcode构建错误
这是flutter version

Flutter 1.2.0 • channel dev • https://github.com/flutter/flutter.git
Framework • revision 06b979c4d5 (3 weeks ago) • 2019-01-25 14:27:35 -0500
Engine • revision 36acd02c94
Tools • Dart 2.1.1 (build 2.1.1-dev.3.2 f4afaee422)

下面是报错日志

Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    While building module 'sona' imported from 
   FlutterWorkspace/ofp_flutter/ios/Runner/GeneratedPluginRegistrant.m:15:
    In file included from <module-includes>:1:
    In file included from FlutterWorkspace/ofp_flutter/build/ios/Debug-iphonesimulator/sona/sona.framework/Headers/sona-umbrella.h:13:
    FlutterWorkspace/ofp_flutter/build/ios/Debug-iphonesimulator/sona/sona.framework/Headers/SonaPlugin.h:2:9: error: include of non-modular header inside framework module 'sona.SonaPlugin': 'FlutterWorkspace/ofp_flutter/ios/Pods/GTSDK/GTSDK.framework/Headers/GeTuiSdk.h' [-Werror,-Wnon-modular-include-in-framework-module]
    #import "GTSDK/GeTuiSdk.h"
            ^
    1 error generated.
    FlutterWorkspace/ofp_flutter/ios/Runner/GeneratedPluginRegistrant.m:15:9: fatal error: could not build module 'sona'
    #import <sona/SonaPlugin.h>
     ~~~~~~~^
    2 errors generated.

Could not build the application for the simulator.
Error launching application on iPhone XR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.