Skip to main content
Version: v5

Gao De Location

Because the original GPS positioning uses Google Browser positioning, and Google withdraws from China, resulting in GPS Android positioning can not be positioned. Gaode location can directly return address informationGaode location can directly return address information

https://github.com/waliu/cordova-plugin-gaodelocation-chenyu.git

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-gaodelocation-chenyu 
$ npm install @awesome-cordova-plugins/gao-de-location
$ ionic cap sync

Supported Platforms

  • Android
  • iOS

Usage

React

Learn more about using Ionic Native components in React

Angular

import { GaoDeLocation } from '@awesome-cordova-plugins/gao-de-location/ngx';


constructor(private gaoDeLocation: GaoDeLocation) { }


const positionOptions: PositionOptions = {
androidOption: {
locationMode: LocationModeEnum.Hight_Accuracy,
gpsFirst: false,
HttpTimeOut: 30000,
interval: 2000,
needAddress: true,
onceLocation: false,
onceLocationLatest: false,
locationProtocol: LocationProtocolEnum.HTTP,
sensorEnable: false,
wifiScan: true,
locationCacheEnable: true
}, iosOption: {
desiredAccuracy: DesiredAccuracyEnum.kCLLocationAccuracyBest,
pausesLocationUpdatesAutomatically: 'YES',
allowsBackgroundLocationUpdates: 'NO',
locationTimeout: 10,
reGeocodeTimeout: 5,
}
};
const positionRes: PositionRes = await this.gaoDeLocation.getCurrentPosition(positionOptions).catch((e: any) => {
console.log(e);
}) || null;
console.log(JSON.stringify(positionRes));


this.gaoDeLocation.startSerialLocation(positionOptions).subscribe((positionRes: PositionRes) => {
console.log(JSON.stringify(positionRes));
});

const positionRes: any = this.gaoDeLocation.stopSerialLocation().catch((e) => {
console.log(e);
}) || null;
console.log(JSON.stringify(positionRes));