Bridge between Wikitude and React Native
npm install react-native-wikitudeFirst install the module via npm and link it up:
``bash
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
1. 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 the node-modules/react-native-wikitude/android folder into your project's android folder:
On Mac / Linux:
`bash`
cd YourReactNativeProject
cp -R ./node_modules/react-native-wikitude/android/wikitudesdk ./android/wikitudesdk
`
or on Windows:
dos`
cd YourReactNativeProject
xcopy node_modules\react-native-wikitude\android\wikitudesdk android\wikitudesdk /E
2. And then in your android/settings.gradle file, modify the existing include ':react-native-wikitude' line to also include the wikitudesdk:`
gradle`
include ':wikitudesdk', ':react-native-wikitude'
android/build.gradle
3. In your file, modify the minimum SDK version to at least version 19:`
gradle`
android {
defaultConfig {
...
minSdkVersion 19
...
}
android/app/src/main/AndroidManifest.xml
4. In your file, If you have it, remove the android:allowBackup="false" attribute from the application node. If you want to set allowBackup, follow the method here.android/build.gradle
5. Optionally: In your file, define the versions of the standard libraries you'd like WikitudeBridge to use:`
gradle`
...
ext {
// dependency versions
compileSdkVersion = "
buildToolsVersion = "
targetSdkVersion = "
constraintLayoutVersion = "
}
...
The module exposes just one function:
`typescript`
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.
`ecmascript 6
import Wikitude from 'react-native-wikitude';
const onButtonPress = () =>
{
Wikitude.startAR('https://yourserver.com/yourwikitudestudioproject/', true, true, true, "YourSDKKey")
};
``
- 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