【问题标题】:react native maps fake & mock location反应原生地图假和模拟位置
【发布时间】:2020-07-05 13:18:14
【问题描述】:

如何确保用户在使用 react 原生地图时不会使用模拟位置和假 gps?

当设备开启开发者模式后,用户仍然可以使用模拟位置,我们有办法阻止它吗?

<MapView
 provider={PROVIDER_GOOGLE}
 ref={ map => { this.map = map }}
region={this.state.mapRegion}
//onRegionChangeComplete={region => this.setState({ region })}
 style={{height: this.state.height}}
 showsUserLocation = {false}
 followUserLocation = {true}
 showsMyLocationButton={false}
 onMapReady={this.onMapReady}
 zoomEnabled = {true}>
 {this.state.geoFenceCoords!=undefined && this.state.geoFenceCoords.map((coords,i) => (
            <MapView.Polygon
            key={i}
                coordinates={coords}
                strokeColor="rgb(84,181,64)"
                strokeWidth={2}
                fillColor="rgba(84,181,64,0.2)" 
                onPress={() => this.onPress()}
                />
        )
)}
  {this.state.lastLat!=null && this.state.lastLong!=null &&   <MapView.Marker
      coordinate={{
        latitude: this.state.lastLat,
        longitude: this.state.lastLong,}}


    >


 <View style={{justifyContent:'center', alignItems:'center',}}>
 <View style={styles.calloutViewPin}>

     {this.state.lastLat!= null && this.state.lastLong!=null && <Text style={styles.textLocPin}>Your current location
    </Text>}
      </View>
      <Image source={marker} style={{width: 20, height: 30, paddingTop: 0, marginTop:0}}/>
      </View>
      </MapView.Marker>}
 </MapView>

【问题讨论】:

  • @Chrispix 你能帮忙吗?

标签: react-native react-native-maps


【解决方案1】:

您可以使用模拟位置检测器解决该问题。这意味着如果用户启用假 GPS,他们使用的是假位置。

看这个:

MOCK GPS DETECTION

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2021-01-01
    • 2021-01-10
    • 2022-09-29
    • 1970-01-01
    相关资源
    最近更新 更多