@mapxus/react-native-mapxus-sdk

0.2.1 • Public • Published

@mapxus/react-native-mapxus-sdk

An official React Native library for package MapxusMap SDKs, both for Android and iOS.

Getting started

  • npm $ npm install @mapxus/react-native-mapxus-sdk --save

  • yarn $ yarn add @mapxus/react-native-mapxus-sdk

iOS Installation

React-Native > 0.60.0

If you are using autolinking feature introduced in React-Native 0.60.0, you just need npm install @mapxus/react-native-mapxus-sdk,

Add the following to your ios/Podfile:

  pre_install do |installer|
      $RNMapxus.pre_install(installer)
      ... other pre install hooks
  end
  post_install do |installer|
    $RNMapxus.post_install(installer)
    ... other post install hooks
  end

followed by pod install from the ios directory. Please also add the pre/post install cocoapods hooks.

Using CocoaPods without autolink

To install with CocoaPods, add the following to your Podfile:

  # Mapxus
  pod 'react-native-mapxus-sdk', :path => '../node_modules/@mapxus/react-native-mapxus-sdk'

Then run pod install and rebuild your project.

Android Installation

React-Native > 0.60.0

If you are using autolinking feature introduced in React-Native 0.60.0 you do not need any additional steps. If not , please follow these steps to sync your project.

Add Kotlin support under dependencies in your android/build.gradle

...
buildscript {
//...
dependencies {
    // ... 
    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32")
    classpath("com.android.tools.build:gradle:4.1.3")
    // ...
				}
//...
} 
...

Add project under dependencies in your android/app/build.gradle

...
dependencies {
    // ... 
    implementation project(':mapxus_react-native-mapxus-sdk')
    // ...
} 
...

Include project, so gradle knows where to find the project

Add the following to your android/settings.gradle

...
include ':mapxus_react-native-mapxus-sdk'
project(':mapxus_react-native-mapxus-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/@mapxus/react-native-mapxus-sdk/android')
...

Also you can overwrite Mapxus dependencies within your android/app/build.gradle

dependencies {
    // ... 
    implementation("com.mapxus.map:mapxusmap:4.2.3")
    implementation ("com.mapxus.positioning:positioning:2.0.9")    
    // ...
    }

Don't forget add mavenCentral repo and jitpack repo to your android/build.gradle

...
allprojects {
    repositories {
    ...
        maven { url 'https://www.jitpack.io' }
        mavenCentral()
    ...
    				}
       	 }
...

Check the current version of the SDK here.

If you want to user visual map , Configure the following codes in AndroidManifest.xml:

	<meta-data
	        android:name="com.mapxus.api.v1.appid"
	        android:value="acquiredkey" />
	<meta-data
	    android:name="com.mapxus.api.v1.secret"
	    android:value="acquiredsecret" />

Usage

import MapxusSdk from '@mapxus/react-native-mapxus-sdk';

// TODO: What to do with the module?
MapxusSdk;

For more usage, please click this link.

Package Sidebar

Install

npm i @mapxus/react-native-mapxus-sdk

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

1.57 MB

Total Files

482

Last publish

Collaborators

  • mapxus