android_location_mocker 0.0.4 copy "android_location_mocker: ^0.0.4" to clipboard
android_location_mocker: ^0.0.4 copied to clipboard

PlatformAndroid

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();

MockLocationBean解释 #

MockLocationBean:
  common:
    useNetwork: #网络模拟开启
    useGps: true #GPS模拟开启
    frequencyMs: 200 #200毫秒
  mockLocation: #经纬度

#窃用且珍惜
1
likes
130
pub points
0%
popularity

Publisher

unverified uploader

android location mocker

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on android_location_mocker