rn-test-plugin
v1.0.0
Published
Mapp SDK for React Native.
Downloads
4
Maintainers
Readme
react-native-mapp-plugin
Getting started
$ npm install https://github.com/MappCloud/React-native-plugin.git --save
**The project is not yet on NPM. Until then, only github integration works **
Mostly automatic installation
For the old version of RN,
$ react-native link react-native-mapp-plugin
Manual installation
iOS
- Install pods
cd ios && pod install
NOTE: If experiencing framework path issues in XCODE
- download plugin manually from github https://github.com/MappCloud/React-native-plugin
- copy from plugin->ios "Frameworks" folder to yourapp/node-modules/react-native-mapp-plugin/ios/ and overwrite existing ones
- Add the following capabilities for your application target:
- Push Notification
- Background Modes > Remote Notifications
- Background Modes > Location updates
- Create a plist
AppoxeeConfig.plist
and include it in your application’s target:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>inapp</key>
<dict>
<key>custom_fields</key>
<array>
<string>customString</string>
<string>customNumber</string>
<string>customDate</string>
</array>
<key>media_timeout</key>
<integer>5</integer>
</dict>
<key>sdk</key>
<dict>
<key>app_id</key>
<string>your app id</string>
<key>dmc_system_id</key>
<integer>your dmc id</integer>
<key>sdk_key</key>
<string>your sdk key</string>
<key>is_eu</key>
<true/>
<key>open_landing_page_inside_app</key>
<false/>
<key>jamie_url</key>
<string>your inapp server url</string>
<key>apx_open_url_internal</key>
<string>YES</string>
</dict>
</dict>
</plist>
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNMappPluginPackage;
to the imports at the top of the file - Add
new RNMappPluginPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-mapp-plugin' project(':react-native-mapp-plugin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapp-plugin/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-mapp-plugin')
Usage
import Mapp from 'react-native-mapp-plugin';
// TODO: What to do with the module?
Mapp;