shareinstall_flutter

A new Flutter plugin for shareinstall.

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

ShareInstall 官网 http://www.shareinstall.com.cn

APP集成

官网注册申请appkey

anroid

1.appid配置

修改文件AndroidManifest.xml

	 <!--配置appkey-->
        <meta-data
            android:name="com.shareinstall.APP_KEY"
            android:value="2EBK2KR2B6BAK7" />//ShareInstall 申请的appkey

2.secheme配置

      <!--配置scheme-->
         <intent-filter>
             <action android:name="android.intent.action.VIEW" />
             <category android:name="android.intent.category.DEFAULT" />
             <category android:name="android.intent.category.BROWSABLE" />
             <data android:scheme="eafb1912" />//ShareInstall 后台应用配置生成的eafb1912
         </intent-filter>

3.gradle 添加依赖

    implementation 'com.android.support:appcompat-v7:26.1.0'

iOS

1.appid配置

在 Info.plist 文件中配置 appKey 键值对,如下:

     <key>com.shareinstall.APP_KEY</key>
<string>从shareinstall官网后台获取自己应用的appkey</string>

2.universal links配置(iOS9以上版本适用)

      开启Associated Domains功能,选中项目文件,选择tagets的对应的taget,再点Capabilities,打开Associated Domains为on,点击+号添加后台提供的管理域名,ps:需要先上传一次包可生成。

3.secheme配置

在 Info.plist 文件中配置

      <key>CFBundleURLTypes</key>
    <array>
        <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>shareinstall</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>"从shareinstall后台获取的scheme"</string>
        </array>
        </dict>
    </array>

4.注意

      a:other linker flags加-ObjC
      b:引用libz.1.2.8.tbd、libc++.1.tbd

dart示例

import 'package:shareinstall_flutter/shareinstall_flutter.dart';

   ShareinstallFlutter.addEventHandler((data) {
    //app后台唤醒 获取唤醒参数 data json字符串
      print("data wakeup newIntent>>>" + data);
    });
    ShareinstallFlutter.getInstall().then((data) {
    //获取安装参数 data json字符串
      print("data install>>>" + data);
    });
    ShareinstallFlutter.getWakeUp().then((data) {
    //获取唤醒参数 data json字符串
      print("data wakeup>>>" + data);
    });

    //调用注册接口  用于统计注册
    ShareinstallFlutter.reportRegister();
    //清除监听
    ShareinstallFlutter.clearAppGetInfoListener();

测试

集成后需打release包上传到官网后台即可使用在线测试地址,进行测试

注意

终端先运行

export PUB_HOSTED_URL=https://pub.flutter-io.cn //国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn //国内用户需要设置

再设置yaml

dev_dependencies:
  flutter_test:
    sdk: flutter

  shareinstall_flutter: ^1.0.2

Libraries

shareinstall_flutter