Quick install
Below, you can find step-by-step guides to easily integrate our SDK and get you going. For the full documentation, please click the button below.
iOS – Swift
Integration with Cocoapods, using Swift. Full documentation here.
1. Update your podfile
Using CocoaPods, add the following to your podfile:
use_frameworks! pod 'PlotPlugin'
2. Run pod install
Run in your terminal:
pod install --repo-update
3. Add usage description
Under the “info” tab in Xcode add the following property list keys and add an description of why you want to acces a users location:
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
4. Add configuration file
Add this file as plotconfig.json in the root folder:
{ "publicToken": "REPLACE_ME", "enableOnFirstRun": true }
5. Add PlotDelegate
Add PlotDelegate to the implemented protocols of your AppDelegate:
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, PlotDelegate
6. Implement AppDelegate
In AppDelegate, add to the func application method:
PlotDebug.initialize(launchOptions: launchOptions, delegate: self)
This method must be called before the end of application!
iOS – Objective C
Integration with Cocoapods, using Objective C. Full documentation here.
1. Update your podfile
Using CocoaPods, add the following to your podfile:
use_frameworks! pod 'PlotPlugin'
2. Run pod install
Run in your terminal:
pod install --repo-update
3. Add usage description
Under the “info” tab in Xcode add the following property list keys and add a description of why you want to acces a users location:
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
4. Add configuration file
Add this file as plotconfig.json in the root folder:
{ "publicToken": "REPLACE_ME", "enableOnFirstRun": true }
5. Add PlotDelegate
Add PlotDelegate to the implemented protocols of your AppDelegate in the header(.h) file:
#import <PlotProjects/Plot.h> @interface AppDelegate : UIResponder<UIApplicationDelegate, PlotDelegate>
6. Implement AppDelegate
application:didFinishLaunchingWithOptions:
call:
[Plot initializeWithDelegate:self];
The initialize method must be called before the end of that method.
Android
Integration with Maven repository. Full documentation here.
1. Integrating the Maven repository
To allow the Plot Projects Android plugin to be found, add the Plot Projects Maven repository to your build.gradle:
allprojects { repositories { google() mavenCentral() // allow gradle to find the Plot Projects Plugin maven { url 'https://maven-repo.plotprojects.com' } } }
2. Add PlotProjects Android plugin
Add the PlotProjects Android plugin as a dependency in your app/build.gradle, check the full documentation for the right .gradle depending on the plugin version:
dependencies { // other dependencies // use compile instead of implementation when using Android Studio 2.x implementation 'com.plotprojects:plot-android:3.19.1' implementation 'androidx.work:work-runtime:2.7.1' implementation 'androidx.work:work-gcm:2.7.1' implementation 'com.google.android.gms:play-services-location:20.0.0' implementation 'com.google.android.gms:play-services-nearby:18.3.0' implementation 'com.google.android.gms:play-services-awareness:19.0.1' implementation platform('com.google.firebase:firebase-bom:30.4.0') implementation 'com.google.firebase:firebase-core' implementation 'com.google.firebase:firebase-messaging' }
3. Set minimum supported Android version
Set the minSdkVersion version to at least 16 in your app/build.gradle:
android { // other android specific gradle configuration defaultConfig { applicationId "com.myplotapplication" minSdkVersion 24 targetSdkVersion 33 versionCode 1 versionName "1.0" } }
4. Define configuration file
Plot uses a configuration file which you have to define (or create) as assets/plotconfig.json:
{ "publicToken": "REPLACE_ME", "enableOnFirstRun": true, "debug": true, "enableCombinedMonitoring": "false" }
5: Almost Done!
Call Plot.init(Activity) to initialize the plugin from your main Activity:
import com.plotprojects.retail.android.Plot; public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // code of your activity
Plot.init(this); // add this line initialize the Plot Plugin } }
1. Install the PlotProjects React Native module
npm install plotprojects-react-native-module --save
2. iOS: Add Configuration File
Add plotconfig.json to both the Android and iOS projects
Add this file as plotconfig.json
in the root folder:
{
"publicToken": "REPLACE_ME",
"enableOnFirstRun": true
}
You can find more information in Step 4 of the iOS Integration guide
3. Android: Add Configuration File
Plot uses a configuration file which you have to define (or create) as assets/plotconfig.json:
{
"publicToken": "REPLACE_ME",
"enableOnFirstRun": true,
"debug": true,
"enableCombinedMonitoring": "false"
}
You can find more information in Step 4 of the Android Integration guide
4. Almost Done!
Add the following code to your App.js
to initialize the plugin:
import { PermissionsAndroid } from 'react-native';
import Plot from 'plotprojects-react-native-module';
const requestLocationPermission = async () => {
try {
if(Platform.OS === "ios") {
initializePlot();
} else {
const granted = await PermissionsAndroid.requestMultiple(
["android.permission.POST_NOTIFICATIONS",
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
]);
if (granted['android.permission.ACCESS_COARSE_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED
|| granted['android.permission.ACCESS_FINE_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED
) {
console.log("Foreground location permission granted!");
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION);
if (granted['android.permission.ACCESS.BACKGROUND_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED {
console.debug("Background location permissions granted!");
} else {
console.debug("Background location permission denied!");
}
InitializePlot();
} else {
console.log("Location permission denied!. Not initializing PlotProjects SDK.");
}
}
} catch (err) {
console.warn(err);
}
};
requestLocationPermission();
1. iOS integration
Since we interact with the native components, the necessary steps to integrate the Plot plugin are the same as for a native iOS app. To open the platform-specific code, select from the menu: Tools > Flutter > Open iOS module in XCode
. The rest of the steps are in the iOS integration guide.
2. Android integration
Since we interact with the native components, the necessary steps to integrate the Plot plugin are the same as for a native Java app. To open the platform-specific code, select from the menu: Tools > Flutter > Open for editing in Android Studio
. The rest of the steps are in the Android integration guide.
Phonegap (Deprecated)
This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates.
Integration for PhoneGap / Cordova / Ionic can be found in our legacy documentation.
More details at our Github.
Appcelerator (Deprecated)
This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates.
Integration for Appcelerator Titanium can be found in our legacy documentation.
Xamarin (Deprecated)
This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates.
Integration for Xamarin can be found in our legacy documentation.
More details at our Github.