qq_mta 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

腾讯统计 Flutter SDK #

author #

zhaolongzhaoyuen123@126.com

Integration Steps #

Step 1: Add Dependency #

  qq_mta: 0.1.1

Step 2: Add permissions (Android) #

The mta SDK requires that you add the INTERNET permission in your Android Manifest file.

<!-- 必选权限< -->
<uses-permission android:name="android.permission.INTERNET"/>
<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.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

使用 AndroidStudio 在 /app/build.gradle 文件下添加以下内容

android {
    ...
    defaultConfig{
      ...
      manifestPlaceholders = [
          //Android AppKey, 用于配置SDK
          MTA_APPKEY:"你的AppKey",
          //标注应用推广渠道用以区分新用户来源,可填写如应用宝,豌豆荚等
          MTA_CHANNEL:"渠道名称"
      ]
    }
}

Step 3: IOS #

pod install

example #

    final QqMta _qqMta = QqMta();

    // 生产请关闭debug
    _qqMta.init(debugEnabled: true);

    // 普通事件
    _qqMta.trackEvent("test");

    // 带参数事件
    _qqMta.trackEvent("test2", parameters:{'a':'a', 'b':'b'});

    /// 注意事件请先在腾讯统计后台导入事件和参数 要不收不到

常见问题 #

解决:java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpPost https://blog.csdn.net/shanshan_1117/article/details/89952128 安卓9.0 Cleartext HTTP traffic to XXX not permitted问题 https://www.jianshu.com/p/fd0b0fd0e34c 上架AppStore 上传IDFA注意事项 https://mta.qq.com/docs/iOS_idfa.html

doc #

官方文档: https://mta.qq.com/docs/

0.0.1 #

  • 集成安卓.

0.1.1 #

  • 集成IOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:qq_mta/qq_mta.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final QqMta _qqMta = QqMta();

  @override
  void initState() {
    super.initState();

    _qqMta.init(debugEnabled: true, iosAppKey: "I82RGZ8IP2JL");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: SizedBox(
            height: 150,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                RaisedButton(
                  onPressed: (){
                    _qqMta.trackEvent("test");
                  },
                  child: Text("trackEvent test"),
                ),
                RaisedButton(
                  onPressed: (){
                    _qqMta.trackEvent("test2", parameters:{'a':'a', 'b':'b'});
                  },
                  child: Text("trackEvent 带参数"),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  qq_mta: ^0.1.1

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:qq_mta/qq_mta.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]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:qq_mta/qq_mta.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:qq_mta/qq_mta.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:qq_mta/qq_mta.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:qq_mta/qq_mta.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • qq_mta that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 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.

Format lib/qq_mta.dart.

Run flutter format to format lib/qq_mta.dart.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test