Installation

Installation instructions for Marketo Mobile SDK.  The steps below are required to send Push Notifications and/or In-App Messages.

How to Install Marketo SDK on iOS

Prerequisites

  1. Add an application in Marketo Admin (obtain your application Secret Key and Munchkin Id)
  2. Setup Push Notifications (optional)

Install Framework via CocoaPods

1. Install CocoaPods.
$ sudo gem install cocoapods
2. Change directory to your project directory and create a Podfile with smart defaults.
$ pod init
3. Open your Podfile.
$ open -a Xcode Podfile
4. Add the following line to your Podfile.
$ pod 'Marketo-iOS-SDK'
5. Save and close your Podfile.
6. Download and install Marketo iOS SDK.
$ pod install
7. Open workspace in Xcode.
$ open App.xcworkspace

Setup Swift Bridging Header

1. Go to File > New > File and Select “Header File”.

ResizedImage600351-Xcode-Choose-Header-File

2. Name the file “<ProjectName>-Bridging-Header”.

3. Go to Project > Target > Build Phases > Swift Compiler > Code Generation.  Add the following path to Objective-Bridging Header:

$(PODS_ROOT)/<ProjectName>-Bridging-Header.h

ResizedImage600323-build-phases

Initialize SDK

Before you can use the Marketo iOS SDK, you must initialize it with your Munchkin Account Id and App Secret Key. You can find each of these in the Marketo Admin area underneath “Mobile Apps & Devices”.

1. Open your AppDelegate.m file (Objective-C) or Bridging file (Swift) and import the Marketo.h header file.

2. Paste the following code inside the application:didFinishLaunchingWithOptions: function.





3. Replace munkinAccountId and secretKey above using your “Munchkin Account ID” and “Secret Key” which are found in the Marketo Admin > Mobile Apps & Devices section.

amobile2

iOS Test Devices

1. Select Project > Target > Info > URL Types.
2. Add identifier: ${PRODUCT_NAME}

Deep_Link_Settings

 

 

 

 

 

 

3. Set URL Schemes: mkto-<Secret Key>
4. Include application:openURL:sourceApplication:annotation: to AppDelegate.m file (Objective-C)

Handle Custom Url Type in AppDelegate





How to Install Marketo SDK on Android

Prerequisites

  1. Add an application in Marketo Admin (obtain your application Secret Key and Munchkin Id)
  2. Setup Push Notifications (optional)
  3. Download Marketo SDK for Android

Andriod SDK Setup

1. Open your project in Android Studio.

doc-mobile-android-installation-open-project

2. Right click on your project and select “Open Module  Settings”.

doc-mobile-android-installation-open-module-settings

3. Click on the plus button “+” in top left corner.

doc-mobile-android-installation-open-project-plus-button

4.  Select “Import .JAR/.AAR package” and click “Next”.

doc-mobile-android-installation-import-package

5.  Click the ellipses  button  “..” and select the location of the .aar file from Marketo Android SDK.

doc-mobile-android-installation-select-aar-file

6. You can change the name of the SubProject and click “Finish”.

doc-mobile-android-installation-name-subproject

7. Right click on your project and select “Open Module Settings”.

doc-mobile-android-installation-open-module-settings-again

8. Select your project name in “Modules” and click on the “Dependancies” tab.

doc-mobile-android-installation-modules-dependencies

9. Click on the plus buttton “+” (at the bottom on Mac, at top corner on Windows) and select “Module dependency”.

doc-mobile-android-installation-modules-dependency-select

10.  Select the SubProject name from  Step 6.

doc-mobile-android-installation-subproject-select

11. Click “OK” and let Gradle sync the project and resolve the dependency.

doc-mobile-android-installation-gradle-resolve-dependency

12. When Gradle sync is complete, it will show you the following info in Gradle Console.

doc-mobile-android-installation-gradle-console

Configure Permissions

Open AndroidManifest.xml and add following permissions. Your app must request the “INTERNET” and “ACCESS_NETWORK_STATE” permissions. If your app already requests these permissions, then skip this step.


Initialize SDK

1. Open the Application or Activity class in your app and import the Marketo SDK into your Activity before setContentView or in Application Context.



2. Configure activities. Add Marketo.onStart, Marketo.onStop in all or in base activity as shown below.



3.  ProGuard Configuration (Optional)

If you are using ProGuard for your app, then add the following lines in your proguard.cfg file. The file will be located within your project folder. Adding this code will exclude the Marketo SDK from the obfuscation process.



Android  Test  Devices

Add “MarketoActivity” to AndroidManifest.xml file inside application tag.