# @remobile/react-native-tencent-geolocation

> a tencent geolocation module for react-native,include ios and android

Latest version **1.0.2** (published 2019-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @remobile/react-native-tencent-geolocation
pnpm add @remobile/react-native-tencent-geolocation
yarn add @remobile/react-native-tencent-geolocation
bun add @remobile/react-native-tencent-geolocation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-02-25 |
| First published | 2019-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | honggao |
| Maintainers | fov42550564, honggao |
| Keywords | geolocation, tencent, react, native, ios, android |

## Links

- npm: https://www.npmjs.com/package/@remobile/react-native-tencent-geolocation
- Repository: https://github.com/remobile/react-native-tencent-geolocation
- Homepage: https://github.com/remobile/react-native-tencent-geolocation#readme
- Issues: https://github.com/remobile/react-native-tencent-geolocation/issues
- npm.io page: https://npm.io/package/@remobile/react-native-tencent-geolocation

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-02-25
- 1.0.1 — 2019-02-25
- 1.0.0 — 2019-02-23

## README

### Installation
npm install @remobile/react-native-tencent-geolocation --save

### Installation (Android)
- settings.gradle `
include ':react-native-tencent-geolocation'
project(':react-native-tencent-geolocation').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-tencent-geolocation/android')`

- build.gradle `compile project(':react-native-tencent-geolocation')`

- MainApplication `new TencentGeoLocationPackage()`

### Installation (iOS)
- Project navigator->Libraries->Add Files to select @remobile/react-native-tencent-geolocation/ios/RCTTencentGeoLocation.xcodeproj
- Project navigator->Build Phases->Link Binary With Libraries add libRCTTencentGeoLocation.a
- Add frameworks to your project, include AMapLocationKit.framework and AMapFoundationKit.framework
- Project navigator->Build Phases->Link Binary With Libraries add AMapLocationKit.framework and AMapFoundationKit.framework
### Usage

module.exports = React.createClass({
    getInitialState () {
        return {
             location: {}
        };
    },
    componentWillMount () {
        SplashScreen.hide();
    },

     componentDidMount () {
        SplashScreen.hide();
        this.configLocationManager();
    },
    configLocationManager () {
        if (!app.isandroid) {
            TencentGeolocation.configLocationManager('AEJBZ-TAICD-44F4N-PZTHZ-JNEAO-VCBMX');
        }
    },
    componentWillUnmount() {
      AMapGeolocation.stopSerialLocation();
  },
    updateLocationState(location) {
      if (location) {
        location.timestamp = new Date(location.timestamp).toLocaleString();
        this.setState({ location });
        console.log(location);
      }
  },
    getLastLocationTencent() {
        TencentGeolocation.getCurrentPosition()
        .then(data => {
            console.warn(JSON.stringify(data));
            this.updateLocationState(data);
        })
        .catch(e => {
            console.warn(e, 'error');
        });
    } ,

    render() {
      const { location } = this.state;
      return (
        <View style={styles.container}>
          <ScrollView style={styles.controls}>
            <Button style={styles.button} onPress={this.getLastLocationAmap}>高德定位</Button>
            <Button style={styles.button} onPress={this.getPositionBaidu}>百度定位</Button>
            <Button style={styles.button} onPress={this.getLastLocationTencent}>腾讯定位</Button>
          </ScrollView>
        </View>
      );
  },
});

const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
    controls: {
        height: sr.h/2,
    },
    button: {
        height: 46,
        width: 300,
        marginLeft: (sr.w - 300) / 2,
        marginTop: 60,
        backgroundColor: '#c81622',
        borderRadius:4,
    },
});

---
_Source: https://npm.io/package/@remobile/react-native-tencent-geolocation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
