JackMcKew / cordova-plugin-background-geolocation-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example Background Geolocation app.

Screenshot

Description

Example app shows some possibilities of cordova-background-geolocation plugin.

Compatibility

Name Version
Cordova CLI 7.1.0
Cordova-Android 6.3.0

How to build

Install dependencies

npm install

Build application

npm run build

* App will be built into www folder.

Add Google Maps API key

Edit variable GOOGLE_MAPS_API_KEY in www/index.html

Build Cordova app

Replace platform with one of supported platforms: android, ios. In this example we will build for Android.

cordova platform add android
cordova build android

There is after_platform_add hook in config.xml which runs script that install all required plugins.

Run on device

iOS

You will need to install ios-deploy package.

npm -g install ios-deploy
cordova run ios --device

Android

cordova run android --device

Run in simulator

iOS

You will need to install ios-sim package first

npm -g install ios-sim

Run in default emulator

cordova emulate ios

You can use cordova run ios --list to see all available targets and cordova run ios --target=target_name to run application on a specific device or emulator (for example, cordova run ios --target="iPhone-6").

Android

To deploy the app on a default Android emulator.

cordova emulate android

You can use cordova run android --list to see all available targets and cordova run android --target=target_name to run application on a specific device or emulator (for example, cordova run android --target="Nexus4_emulator").

App Development

Cordova Example App is sharing code with react-native variant. Native libraries are aliased to use their web variants. That is possible thanks to amazing webpack, native-base-web, react-native-web projects.

For development install and use webpack-dev-server:

webpack-dev-server --content-base src/

iOS quirks

If you're using XCode, boot the SampleApp in the iOS Simulator and enable Debug->Location->City Drive.

About


Languages

Language:JavaScript 97.2%Language:HTML 1.5%Language:CSS 1.2%