0 purchases
android location mocker
Getting Started #
通过android系统的模拟,实现丁丁远程打卡
final _androidLocationMockerPlugin = AndroidLocationMocker();
// 是否在系统设置界面吧模拟位置应用选上
bool res = await _androidLocationMockerPlugin.isReady();
// 判断是否处于开发者模式
var res =
await _androidLocationMockerPlugin.isOpenDevMode();
// 打开开发者模式的系统设置界面
var res =
await _androidLocationMockerPlugin.openDevMode();
// 开启模拟,注意:MockLocationBean里面每个参数都必填
var bean = MockLocationBean(
common: Common(
useGps: isUseGps,
useNetwork: isUseNetwork,
frequencyMs:
int.tryParse(frequencyController.text) ??
100),
mockLocation: MockLocation(
lat: currentLatlng?.latitude ?? 0,
lng: currentLatlng?.longitude ?? 0));
_androidLocationMockerPlugin.startMock(bean);
// 停止模拟
var res = await _androidLocationMockerPlugin.stopMock();
copied to clipboard
MockLocationBean解释 #
MockLocationBean:
common:
useNetwork: #网络模拟开启
useGps: true #GPS模拟开启
frequencyMs: 200 #200毫秒
mockLocation: #经纬度
#窃用且珍惜
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.