index01d / react-native-background-geolocation-example

Example app of react-native-mauron85-background-geolocation component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 DebugLocation 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
ezoic increase your site revenue

About

Example app of react-native-mauron85-background-geolocation component.


Languages

Language:JavaScript 66.2%Language:Objective-C 19.8%Language:Python 7.5%Language:Java 6.5%