ali_real_person 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

安装 #

  • pubspec.yaml中加入
 dependencies:
    ali_real_person: ^0.0.2

##使用方法(使用前请先完成Android & IOS 配置)

import 'package:ali_real_person/ali_real_person.dart';

//...

//在需要唤起实人认证处调用方法,需要入参token,token从服务端获取
  AliRealPerson.startRealPerson(token, (value) {
            //返回字符串
            // "1" 认证成功,
            // "2"  认证失败
            // "-1"  未认证
            if (value == "1") {
              print("认证通过");
            }
  });

Android & IOS 配置 #

在阿里云实人认证控制台下载SDK,本插件中的版本为最新的4.0.4。如果更新了的话自行替换依赖库即可 下载后解压,会得到一个yw_1222_*.jpg签名文件 和 client.zip压缩包 注意:Android debug包和release包在使用不同签名时不能混用同一张签名图片文件


Android配置 #

  • yw_1222_*.jpg签名图片文件导入到工程应用模块的res/drawable目录下
  • 配置app/build.gradle
repositories {
    flatDir {
        dirs project(':ali_real_person').file('libs')
    }
}
  • 在AndroidManifest.xml中配置以下内容(若有则忽略)
<!--        ....  -->
    <!--配置相机权限-->
<uses-permission android:name="android.permission.CAMERA"/>
    
<!--        ....  -->
<application
        android:label="@string/app_name"
        android:allowBackup="false"
        tools:replace="android:allowBackup"
        >
    <!--        ....  -->
</application>

目前实人SDK(4.0.4)依赖包不兼容较新的gradle 5.4.1及gradle tools 3.5版本。如果你的gradle版本过高参考以下方法进行降级

  • 修改 gradle 版本改为5.1.1(含)以下, 位于gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
  • 修改 gradle tools 版本改为3.4(含)以下
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        //....
    }
  • Android如果再调起实人认证拍摄页面时闪退可以尝试关闭混淆试试,可参考example/android/app/build.gradle
    minifyEnabled false
    shrinkResources false

IOS配置 #

  • 导入以下资源文件。导入时必须勾选Copy items if needed,表示自动复制一份相同的文件到工程中,并引用复制后的文件在工程目录中的位置。
yw_1222_0769.jpg
RPSDK.bundle

image.png 导入完成后,您可以在Build Phases > Copy Bundle Resources看到资源文件。如果未看到资源文件,则说明导入过程中出现问题,请确认将所有资源文件拷贝到工程项目,并勾选正确应用目标。

  • 配置相机权限,若有则忽略
	<key>NSCameraUsageDescription</key>
	<string>APP需要您授权才能访问相机</string>

以下内容每次执行完 pod install 都需要自己手动配置一下,否则无法运行,如果路过的IOS大神知道怎么配置podspec麻烦留言告诉我一下,感谢

  • 修改【插件Bundle ID的前缀】为【主工程的 Bundle ID】

org.cocoapods.ali-real-person 修改为 your bundle.ali-real-person

0.0.2 #

  • 优化example
  • Ios自动配置 -ObjC

0.0.1 #

  • Flutter Ali RealPerson,support Android and IOS

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: GestureDetector(
            onTap: () {
              var token = "xxxxx";
              AliRealPerson.startRealPerson(token, (value) {
                //返回字符串
                // "1" 认证成功,
                // "2"  认证失败
                // "-1"  未认证
                if (value == "1") {
                  print("认证通过");
                }
              });
            },
            child: Text('Click Run Ali RealPerson'),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ali_real_person: ^0.0.2

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:ali_real_person/ali_real_person.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
4
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Jul 9, 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:ali_real_person/ali_real_person.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

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

Package does not support Flutter platform web

Because:

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

Package does not support Flutter platform windows

Because:

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

Package not compatible with SDK dart

Because:

  • ali_real_person that is a package requiring null.

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.

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.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

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