Coder Social home page Coder Social logo

react-native-geolocation-example's Introduction

React Native Background Geolocation Example

Screenshot

Intro

This is an example app of react-native-mauron85-background-geolocation component.

Binary build

There is apk in dist folder.

How to build

In cloned directory:

  1. npm install

Also read setup instructions.

Android

Check android lib versions:

Name Version
Google Play Services >=30
Google Repository >=28

Generate your SHA1 key to restrict usage to your app only (optional):

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

Go to Google API Console and select your project, or create new one:

In Overview -> Google Maps API -> Google Maps Android API -> Check if it's enabled. If not, click button Enable! Create a new key by clicking on Create credentials -> API Key -> Android Key, enter the name of the API key and your SHA1 key, generated before, and create it.

Add Google Maps Android API Key in android/app/src/main/res/values/strings.xml:

<resources>
    ...
    <string name="google_api_key">{{Your Google maps API Key Here}}</string>
</resources>

Module react-native-maps v0.8.2 requires Google Play Services library version 9.4.0, we need to change node_modules/react-native-mauron85-background-geolocation/android/lib/build.gradle

dependencies {
    ...
    compile 'com.google.android.gms:play-services-location:9.4.0'
    ...
}

More info https://github.com/lelandrichardson/react-native-maps/blob/master/docs/installation.md

Run in Simulator

adb reverse tcp:8081 tcp:8081

react-native run-android

Run on Device

$ cd android && ./gradlew installDebugAndroidTest

iOS

in iOS Simulator: Enable Freeway Drive in Debug โžœ Location menu.

Run in Simulator

react-native run-ios

Troubleshoot

Android

Check adb logcat for errors. For example wrong API key:

E/Google Maps Android API(31792): Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API(31792): In the Google Developer Console (https://console.developers.google.com)
E/Google Maps Android API(31792): Ensure that the "Google Maps Android API v2" is enabled.
E/Google Maps Android API(31792): Ensure that the following Android Key exists:
E/Google Maps Android API(31792): 	API Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA                                             
E/Google Maps Android API(31792): 	Android Application (<cert_fingerprint>;<package_name>): 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00;com.rnbgexample

react-native-geolocation-example's People

Contributors

mauron85 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.