react-native-anavi
Version:
react native amap navigation component, Android + iOS
159 lines (158 loc) • 3.88 kB
TypeScript
export declare class ALocationProxy {
listener: ALocationListner;
constructor(listener: ALocationListner);
stop(): void;
}
declare class ALocationListner {
once: boolean;
background: boolean;
callback: (location: ALocation) => void;
callbackTarget: any;
constructor(once: boolean, backgroud: boolean, callback: (location: ALocation) => void);
apply(location: ALocation): void;
}
interface LocationError {
readonly code: number;
readonly info: string;
readonly details: string;
}
interface LocationQualityReport {
/**
* 获取提示语义,状态良好时,返回的是内容为空 根据当前的质量报告,给出相应的建议
*/
readonly adviseMessage: string;
/**
* 获取当前的卫星数, 只有在非低功耗模式下此值才有效
*/
readonly gpsSatellites: number;
/**
* 获取卫星状态信息,只有在非低功耗模式下此值才有效
*/
readonly gpsStatus: number;
/**
* 获取网络定位时的网络耗时 单位:毫秒
*/
readonly netUseTime: number;
/**
* 获取网络连接类型(2G、3G、4G、WIFI)
*/
readonly networkType: string;
/**
* 是否安装了高危位置模拟软件 首次定位可能没有结果
*/
readonly isInstalledHighDangerMockApp: boolean;
/**
* wifi开关是否打开 如果wifi关闭建议打开wifi开关,提高定位质量
*/
readonly isWifiAble: boolean;
}
export interface ALocation {
/**
*
*/
readonly error: LocationError;
/**
* 获取定位结果来源
*/
readonly type: number;
/**
* 获取纬度
*/
readonly latitude: number;
/**
* 获取纬度
*/
readonly longitude: number;
/**
* 获取定位精度
*/
readonly accuracy: number;
/**
* 获取定位提供者
*/
readonly provider: string;
/**
* 获取速度
*/
readonly speed: number;
/**
* 获取角度
*/
readonly bearing: number;
/**
* 获取当前可用卫星数量, 仅在卫星定位时有效
*/
readonly satellites: number;
/**
* 获取国家名称
*/
readonly country: string;
/**
* 获取城市名称
*/
readonly city: string;
/**
* 获取城市编码
*/
readonly cityCode: string;
/**
* 获取区域名称
*/
readonly district: string;
/**
* 获取区域编码
*/
readonly districtCode: string;
/**
* 获取地址
*/
readonly address: string;
/**
* 获取兴趣点
*/
readonly poiName: string;
/**
* 获取定位时间
*/
readonly time: number;
/**
* 获取定位质量报告
*/
readonly quality: LocationQualityReport;
}
export declare type ALocationCallback = (location: ALocation) => void;
export declare class ALocationClientOptions {
httpTimeout?: number;
interval?: number;
cacheEnabled?: boolean;
mode?: 'Battery_Saving' | 'Device_Sensors' | 'Hight_Accuracy';
protocol?: 'HTTP' | 'HTTPS';
mockEnabled?: boolean;
needAddress?: boolean;
sensorEnable?: boolean;
wifiScan?: boolean;
}
/**
* 高德定位服务
*/
export declare class ALocationClient {
private constructor();
private static instance;
/**
* 获取ALoaction的单例
*/
static getInstace(): ALocationClient;
/**
* 当前是否已启用后台定位
*/
get isBackground(): boolean;
/**
* 获取或设置定位选项
*/
set options(options: ALocationClientOptions);
get options(): ALocationClientOptions;
location(callback: ALocationCallback, background?: boolean): ALocationProxy;
locationOnce(callback: ALocationCallback): void;
private checkIsAutoStop;
}
export {};