flt_umengpush_core 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

flt_umengpush_core #

友盟推送核心包

安装方法 #

//pub
dependencies:
  flt_umengpush_common: ^lastest_version
  flt_umengpush_core: ^lastest_version

//import
dependencies:
  flt_umengpush_common:
    git:
      url: git://github.com/RandyWei/flt_umengpush_common.git
  flt_umengpush_core:
    git:
      url: git://github.com/RandyWei/flt_umengpush_core.git

Android #

创建App类继承io.flutter.app.FlutterApplication

class App: FlutterApplication() {
    override fun onCreate() {
        super.onCreate()

        val appKey = "友盟AppKey"
        val secret = "友盟secret"
        FltUmengpushCommonPlugin.init(this,appKey,secret)
        FltUmengpushCorePlugin.register(this)
    }
}

然后在AndroidManifest.xml中使用该类,并配置权限

<manifest
    ...
    xmlns:tools="http://schemas.android.com/tools" >

    <!-- 必须的权限 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    
    <!-- 推荐的权限 -->
    <!-- 添加如下权限,以便使用更多的第三方SDK和更精准的统计数据 -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application android:name=".App">
        ...
    </application>
</manifest>

iOS #

swift #

在 项目名-Bridgin-Header.h中导包

#import "FltUmengpushCommonPlugin.h"

在ApppDelegate中添加以下代码

@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    
    //初始化友盟推送
    FltUmengpushCommonPlugin.initWithAppKey("友盟推送AppKey", channel: "渠道")
    
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

oc #

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#include <FltUmengpushCommonPlugin.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  // Override point for customization after application launch.
    //初始化友盟推送
    [FltUmengpushCommonPlugin initWithAppKey:@"友盟推送appKey" channel:@"渠道"];
    
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

dart代码 #

在程序入口监听通知

  @override
  void initState() {
    super.initState();
      FltUmengpushCore.listen(tokenCallback: (token) {
          //注册成功token回调
          print("deviceToken:$token");
        }, notificationCallback: (pushData) {
          //点击通知回调,pushData为自定义数据,按需进行添加逻辑代码
          print("data:$pushData");
        });
      }
  }

1.0.0 #

  • 推送核心代码

example/README.md

flt_umengpush_core_example #

Demonstrates how to use the flt_umengpush_core plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flt_umengpush_core: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flt_umengpush_core/flt_umengpush_core.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Nov 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test