Welcome to our Support Center

iOS Installation Instructions

Install the iOS SDK in 3 Minutes!

Install the Segments SDK in Xcode in minutes! Don’t believe me, watch this video and do it yourself in three minutes. You can use our installation doc to follow along.

1.Download the SDK for iOS
2.Add frameworks to your Project

Click on Targets → Your app name → and then the ‘Build Phases’ tab. Click the + button in the bottom left of the ‘Link Binary With Libraries’ section and add the following libraries:

  • CoreLocation.framework
  • SystemConfiguration.framework
  • CoreTelephony.framework
  • libz.dylib
  • 3.Import the SDK into your Project

    Open up your AppDelegate.m file and add the following import to the top of the file:

    #import <SegmentsSDK/SegmentsSDK.h>
    4.Add Activation code for your App

    Copy and paste your unique App ID from the Marlin Mobile page into your activation code.

    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        
    	[SegmentsSDK startWithAppId:@"MY_APP_ID"];
    	return YES;
    }
    

    Android Installation Instructions

    Install the Android SDK in under 4 minutes!

    Install the Segments SDK in Eclipse in minutes! Don’t believe me, watch this video and do it yourself in four minutes. You can use our installation doc to follow along.

    1.Download the SDK for Android
    2.Import the SDK into your project

    Add the libs segments-sdk.1.3.jar and gson-2.2.2.jar in the libs folder. If you’re using Eclipse, modify your Java Build Path, and choose Add External JAR. Once installed confirm that both jar files are selected to export.

    If you are using the Google Play Library to display ads use the lib segments-sdk-googleplaylib.1.3.jar to capture the Android advertising id.

    3.Add permissions

    Add the following permissions to AndroidManifest.xml

    Required<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    
    Optional<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    

    To see why we need certain permissions read our FAQ.

    4.Add Activation code for your App

    In the main activity, add the following to your onStart.

    @Override
    protected void onCreate()
    {
    	super.onCreate();
    }
    	public void onStart() {
    		super.onStart();
    		SegmentsAgent.getInstance(this, "MY_APP_ID").register();
    }
    

    If you did not automatically import the SDK add the import line to the import section of the main activity:

    import com.segment.intelligence.sdk.SegmentsAgent;