Skip to content

Latest commit

 

History

History
156 lines (107 loc) · 4.83 KB

Maps_Location.md

File metadata and controls

156 lines (107 loc) · 4.83 KB

Packages

React Native Maps

react-native-maps

Installation

Android Maps Utilities

Google APIs for Android

MapView Methods

Visual Explanation animateToRegion

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_API_KEY"/>

Docs

Examples

Blog - Introduction to react-native-maps

React Native Location

react-native-location

React Native Geolocation Service

react-native-geolocation-service

Uses the recommended Google Location Services API.

npm install react-native-geolocation-service

Examples

if (Platform.OS !== "android") {
  Geolocation.requestAuthorization();
} else {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
      {
        title: "",
        message: "",
        buttonNeutral: "Ask Me Later",
        buttonNegative: "Cancel",
        buttonPositive: "OK",
      }
    );
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    } else {
    }
  } catch (error) {}
}

info.plist

NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription

AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Ref: Setup

React Native Geolocation

react-native-geolocation

Uses the android.location API which is not recommended by Google because it is less accurate and slower than the recommended Google Location Services API.

React Native Open Maps

react-native-open-maps

React Native Map Link

react-native-map-link

React Native Maps Directions

react-native-maps-directions

Example

TypeScript and Google Maps

npm i -D @types/googlemaps

Reference: TypeScript and Google Maps

Parse Google Maps Address_Components

const address = address_components.reduce((seed, { long_name, types }) => {
  types.forEach((t) => {
    seed[t] = long_name;
  });

  return seed;
}, {});

How to parse google maps Address components. (geocoder response)

Apps

How to spoof your location on Android

  • Download a GPS spoofing app
  • Enable Developer options
  • Select mock location app
  • Spoof your location

Fake GPS GO Location Spoofer Free Fake GPS location

How to spoof your location on iOS

iFakeLocation

How to Use