quake_android_native_methods 0.0.2
quake_android_native_methods: ^0.0.2 copied to clipboard
quake native methods plugin
[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"
}
]
返回字段 | 类型 | 说明 |
---|---|---|
picName | String | 图片名称 |
url | String | 图片本地路径 |
w | String | 图片宽 |
h | String | 图片高 |
imageUri | String | 图片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"
}
返回字段 | 类型 | 说明 |
---|---|---|
photoPath | String | 照片本地路径 |
photoWidth | String | 照片宽 |
photoHeight | String | 照片高 |
photoName | String | 照片名称 |
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
}
返回字段 | 类型 | 说明 |
---|---|---|
videoName | String | 视频名称 |
videoUrl | String | 视频本地路径 |
videoDuration | String | 视频时长 |
coverName | String | 封面名称 |
coverUrl | String | 封面本地路径 |
coverWidth | String | 封面宽 |
coverHeight | String | 封面高 |
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}
返回字段 | 类型 | 说明 |
---|---|---|
videoName | String | 视频名称 |
videoUrl | String | 视频本地路径 |
videoDuration | String | 视频时长 |
coverName | String | 封面名称 |
coverUrl | String | 封面本地路径 |
coverWidth | String | 封面宽 |
coverHeight | String | 封面高 |
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"
}
返回字段 | 类型 | 说明 |
---|---|---|
fileName | String | 文件名称 |
fileSize | String | 文件大小 |
fileUrl | String | 文件本地路径 |
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
参数
参数 | 类型 | 说明 |
---|---|---|
url | String | 文件路径 |
返回字段
{
"snapShotUrl":"\/storage\/emulated\/0\/Quake\/fileSnapshot\/test\/document\/.jpg"
}
返回字段 | 类型 | 说明 |
---|---|---|
snapShotUrl | String | 截图存储路径 |
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
}
返回字段 | 类型 | 说明 |
---|---|---|
locScreenShotUrl | String | 截图存储路径 |
locScreenShotName | String | 截图名称 |
location | String | 地址 |
latitude | Double | 纬度 |
longitude | Double | 经度 |
9.扫描二维码:
static Future<String?> scanQRCode() async {
final String? res = await _channel.invokeMethod('scanQRCode');
return res;
}
返回字段
# 成功
{
"result":"eyJvcmdJRCI6ICIxMyJ9",
"code":1500
}
# 失败
{
"result":"解析二维码失败",
"code":1400
}
返回字段 | 类型 | 说明 |
---|---|---|
result | String | 二维码解析结果 |
code | int | 1500:成功 \ 1400:失败 |