flt_umengpush_utdid 1.0.0

flt_umengpush_utdid #

友盟推送 utdid 包

安装方法 #

//pub
dependencies:
  flt_umengpush_common: ^lastest_version
  flt_umengpush_utdid: ^lastest_version   #如果项目中有其他三方库引入了utdid,无需加入该插件
  flt_umengpush_core: ^lastest_version

//import
dependencies:
  flt_umengpush_common:
    git:
      url: https://github.com/RandyWei/flt_umengpush.git
      path: flt_umengpush_common
  flt_umengpush_core:
    git:
      url: https://github.com/RandyWei/flt_umengpush.git
      path: flt_umengpush_core
  flt_umengpush_utdid:    #如果项目中有其他三方库引入了utdid,无需加入该插件
    git:
      url: https://github.com/RandyWei/flt_umengpush.git
      path: flt_umengpush_utdid

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 #

  • initial release.

example/README.md

flt_umengpush_utdid_example #

Demonstrates how to use the flt_umengpush_utdid 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_utdid: ^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_utdid/flt_umengpush_utdid.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 Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health issues and suggestions

Document public APIs. (-1 points)

4 out of 4 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.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test