Files

73 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2015-10-11 11:53:56 -07:00
#### Step 1 - NPM Install
2016-07-23 12:04:09 +03:00
Run with ```--ignore-scripts``` if you don't want to download the iOS SDK, as well.
2015-11-11 09:59:00 +08:00
2015-10-11 11:53:56 -07:00
```shell
2015-11-11 09:59:00 +08:00
npm install --save react-native-mapbox-gl --ignore-scripts
2015-10-11 11:53:56 -07:00
```
2016-07-04 11:44:01 +03:00
#### Step 2 - Use with Gradle
##### Option A - Automatically
2016-07-04 11:44:01 +03:00
```shell
react-native link
2016-07-04 11:44:01 +03:00
```
##### Option B - Manually
Edit the following files:
2015-10-11 11:53:56 -07:00
```gradle
// file: android/settings.gradle
...
2015-12-14 11:19:51 -08:00
include ':reactnativemapboxgl'
2015-10-11 11:53:56 -07:00
project(':reactnativemapboxgl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapbox-gl/android')
```
```gradle
// file: android/app/build.gradle
...
dependencies {
...
compile project(':reactnativemapboxgl')
}
```
2016-01-20 10:36:04 -08:00
```java
// file: android/app/src/main/java/com/yourcompany/yourapp/MainApplication.java
2016-01-20 10:36:04 -08:00
import com.mapbox.reactnativemapboxgl.ReactNativeMapboxGLPackage; // <-- import
...
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
2016-01-20 10:43:14 -08:00
new ReactNativeMapboxGLPackage()); // <-- Register package here
2016-01-20 10:36:04 -08:00
}
2015-10-11 11:53:56 -07:00
```
2016-07-04 11:44:01 +03:00
#### Step 3 - Add Mapbox to AndroidManifest.xml
Add the following permissions to the `<manifest>` root node of your `AndroidManifest.xml`:
2016-07-04 11:44:01 +03:00
```xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
```
Also, add the Mapbox analytics service to the `<application>` node:
2016-07-04 11:44:01 +03:00
```xml
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/>
```
#### Step 4 - Add to project, [see example](../example.js)