react-native-wikitude
v2.0.4
Published
Bridge between Wikitude and React Native
Downloads
11
Maintainers
Readme
React Native Wikitude Bridge
Introduction
This is a React Native bridge module for Wikitude which provides a simple integration to the Wikitude AR SDK. At the moment, the module only supports loading AR experiences from Wikitude Studio URLs. These can be local or online locations. You would normally export the files from Wikitude Studio and then host them in a directory somewhere yourself. Point your app to that URL and it should load your project.
How to install
First install the module via npm and link it up:
npm install react-native-wikitude
react-native link react-native-wikitude
After that completes, you will need to do additional steps for each platform you are supporting:
Android
Unfortunately the gradle system does not seem to allow sub-linking aar files. To get around this you will have to install the
wikitudesdk
folder manually into each project you plan to use this module with.Copy the
wikitudesdk
folder from thenode-modules/react-native-wikitude/android
folder into your project'sandroid
folder:On Mac / Linux:
cd YourReactNativeProject cp -R ./node_modules/react-native-wikitude/android/wikitudesdk ./android/wikitudesdk
or on Windows:
cd YourReactNativeProject xcopy node_modules\react-native-wikitude\android\wikitudesdk android\wikitudesdk /E
And then in your
android/settings.gradle
file, modify the existinginclude ':react-native-wikitude'
line to also include thewikitudesdk
:include ':wikitudesdk', ':react-native-wikitude'
In your
android/build.gradle
file, modify the minimum SDK version to at least version 19:android { defaultConfig { ... minSdkVersion 19 ... }
In your
android/app/src/main/AndroidManifest.xml
file, If you have it, remove theandroid:allowBackup="false"
attribute from theapplication
node. If you want to set allowBackup, follow the method here.Optionally: In your
android/build.gradle
file, define the versions of the standard libraries you'd like WikitudeBridge to use:... ext { // dependency versions compileSdkVersion = "<Your compile SDK version>" // default: 27 buildToolsVersion = "<Your build tools version>" // default: "27.0.3" targetSdkVersion = "<Your target SDK version>" // default: 27 constraintLayoutVersion = "<Your com.android.support.constraint:constraint-layout version>" //default "1.0.2" } ...
iOS
At the moment, iOS integration is not documented. Please contribute to update me!
Usage
The module exposes just one function:
function startAR(architectWorldURL: string, hasGeolocation:boolean, hasImageRecognition:boolean, hasInstantTracking:boolean, wikitudeSDKKey:string)
This function will open a new Wikitude view on top of your current view and open the specified URL.
import Wikitude from 'react-native-wikitude';
const onButtonPress = () =>
{
Wikitude.startAR('https://yourserver.com/yourwikitudestudioproject/', true, true, true, "YourSDKKey")
};
ChangeLog
2.0.4 Minor Gradle file issue fixed.
2.0.3 Keep screen on in Android
2.0.2 Fixed errors, added SDK Key field
2.0.1 Fixed android build process
2.0.0 First Commit