0.0.11 • Published 10 months ago

uclean-location-plugin v0.0.11

Weekly downloads
1
License
MIT
Repository
-
Last release
10 months ago

插件安装与卸载

卸载插件

npm uninstall uclean-location-plugin

安装插件

npm install uclean-location-plugin

在android/app/src/main/java/com/ujing/franchisee/MainActivity.java 的init方法中增加 add( UcleanLocationPlugin.class );

this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
  // Additional plugins you've installed go here
  // Ex: add(TotallyAwesomePlugin.class);
  add( UcleanLocationPlugin.class );
}});

js调用方法

单次获取当前的地理信息

const { UcleanLocationPlugin } = Capacitor.Plugins;
const result = await UcleanLocationPlugin.getCurrentLocation({
  altitude: false,
  isHighAccuracy: false,
  isOnlyLocation: true
});
参数
{
  altitude: false, //是否返回高度信息
  isHighAccuracy: false,//开启高精度定位
  isOnlyLocation: false,//是否只返回经纬度位置信息
}
返回值格式
{
  errorCode: string,//定位错误码
  errorMessage: string,//错误信息
  result:object //定位数据
}

连续定位

const { UcleanLocationPlugin } = Capacitor.Plugins;
const result = await UcleanLocationPlugin.onLocationInfoChange();
返回值格式
{
  errorCode: string,//定位错误码
  errorMessage: string,//错误信息
  result:object //定位数据
  }

监听位置变化 - 方法

const { UcleanLocationPlugin } = Capacitor.Plugins;
const deviceListener = UcleanLocationPlugin.addListener('onLocationInfoChange',(result) => {})

关闭定位

const { UcleanLocationPlugin } = Capacitor.Plugins;
const result = await UcleanLocationPlugin.offLocationInfoChange();
返回值格式
{
  errorCode: string,
  errorMessage: string,
}
0.0.10

10 months ago

0.0.11

10 months ago

0.0.9

1 year ago

0.0.8

2 years ago

0.0.7

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.1

4 years ago