TOC

夸克安卓原生方法插件

夸克安卓原生方法插件

使用方法:

调用Android原生方法

1.从相册选择图片:

static Future<String?> chooseImgFromGallery() async {
    final String? res = await _channel.invokeMethod('chooseImgFromGallery');
    return res;
  }

返回字段:****

[
    {
        "picName":"IMG1929167290848708488.png",
        "url":"\/storage\/emulated\/0\/FaceDetectionSystem\/IMG1929167290848708488.png",
        "w":1080,
        "h":1920,
        "imageUri":"content:\/\/media\/external\/images\/media\/8916"
    },
    {
        "picName":"Screenshot_2021-10-02-16-30-35-339_com.lbe.security.miui.jpg",
        "url":"\/storage\/emulated\/0\/DCIM\/Screenshots\/Screenshot_2021-10-02-16-30-35-339_com.lbe.security.miui.jpg",
        "w":1080,
        "h":1920,
        "imageUri":"content:\/\/media\/external\/images\/media\/7723"
    },
    {
        "picName":"takePhoto1632994658702.jpg",
        "url":"\/storage\/emulated\/0\/Quake\/Photograph\/takePhoto1632994658702.jpg",
        "w":3120,
        "h":4160,
        "imageUri":"content:\/\/media\/external\/images\/media\/7715"
    }
]
返回字段类型说明
picNameString图片名称
urlString图片本地路径
wString图片宽
hString图片高
imageUriString图片uri

2.拍照:

static Future<String?> photograph() async {
    final String? res = await _channel.invokeMethod('photograph');

    return res;
  }

返回字段

{
    "photoPath":"\/storage\/emulated\/0\/Quake\/Photograph\/takePhoto1635478818664.jpg",
    "photoWidth":3120,
    "photoHeight":4160,
    "photoName":"takePhoto1635478818664.jpg"
}
返回字段类型说明
photoPathString照片本地路径
photoWidthString照片宽
photoHeightString照片高
photoNameString照片名称

3.从视频选择器选择视频:

 static Future<String?> chooseVideoFromSelector() async {
    final String? res = await _channel.invokeMethod('chooseVideoFromSelector');
    return res;
  }

返回字段

{
    "videoName":"VID_20211027_163349.mp4",
    "videoUrl":"\/storage\/emulated\/0\/DCIM\/Camera\/VID_20211027_163349.mp4",
    "videoDuration":0,
    "coverName":"videoCover1635478990411.jpeg", "coverUrl":"\/storage\/emulated\/0\/Android\/data\/quake.quake_android_native_methods\/cache\/videoCover1635478990411.jpeg",
    "coverWidth":2160,
    "coverHeight":3840
}
返回字段类型说明
videoNameString视频名称
videoUrlString视频本地路径
videoDurationString视频时长
coverNameString封面名称
coverUrlString封面本地路径
coverWidthString封面宽
coverHeightString封面高

5.录像:

static Future<String?> videoRecording() async {
    final String? res = await _channel.invokeMethod('videoRecording');
    return res;
  }

返回字段

{
    "videoName":"VID_20211029_114600.mp4",
    "videoUrl":"\/storage\/emulated\/0\/DCIM\/Camera\/VID_20211029_114600.mp4",
    "videoDuration":1,
    "coverName":"videoCover1635479165517.jpeg",
    "coverUrl":"\/storage\/emulated\/0\/Android\/data\/quake.quake_android_native_methods\/cache\/videoCover1635479165517.jpeg",
    "coverWidth":2160,
    "coverHeight":3840}
返回字段类型说明
videoNameString视频名称
videoUrlString视频本地路径
videoDurationString视频时长
coverNameString封面名称
coverUrlString封面本地路径
coverWidthString封面宽
coverHeightString封面高

6.从文件选择器选择文件:

static Future<String?> chooseFileFromSelector() async {
    final String? res = await _channel.invokeMethod('chooseFileFromSelector');
    return res;
  }

返回字段

{
    "fileName":"新建文本文档.txt",
    "fileSize":47,
    "fileUrl":"\/storage\/emulated\/0\/bluetooth\/新建文本文档.txt"
}
返回字段类型说明
fileNameString文件名称
fileSizeString文件大小
fileUrlString文件本地路径

7.浏览文件:

static Future<String?> browseFile(String url) async {
    final String? res = await _channel
        .invokeMethod('browseFile', <String, dynamic>{'url': url});
    return res;
  }/storage/emulated/0/Quake/fileSnapshot/test/document/.jpg

参数

参数类型说明
urlString文件路径

返回字段

{
    "snapShotUrl":"\/storage\/emulated\/0\/Quake\/fileSnapshot\/test\/document\/.jpg"
}
返回字段类型说明
snapShotUrlString截图存储路径

8.发送定位:

static Future<String?> sendLocation() async {
    final String? res = await _channel.invokeMethod('sendLocation');
    return res;
  }

返回字段

{
    "locScreenShotUrl":"\/storage\/emulated\/0\/Android\/data\/quake.quake_android_native_methods\/cache\/location_20211029115351.png",
    "locScreenShotName":"location_20211029115351.png",
    "location":"福建省福州市台江区新港街道五一中路大利嘉城(状元街11号)",
    "latitude":26.067215,
    "longitude":119.312812
}
返回字段类型说明
locScreenShotUrlString截图存储路径
locScreenShotNameString截图名称
locationString地址
latitudeDouble纬度
longitudeDouble经度

9.扫描二维码:

static Future<String?> scanQRCode() async {
    final String? res = await _channel.invokeMethod('scanQRCode');
    return res;
  }

返回字段

# 成功
{
    "result":"eyJvcmdJRCI6ICIxMyJ9",
    "code":1500
}
# 失败
{
    "result":"解析二维码失败",
    "code":1400
}
返回字段类型说明
resultString二维码解析结果
codeint1500:成功 \ 1400:失败

Libraries

quake_android_native_methods