Skip to content

How-to guides

Installing the SDK

For the latest MVPN SDK APIs and examples, see the download page.

Setting up the SDK

  1. Unzip mVPNSDK.zip. Library folder contains all the necessary libraries required to build Android App using Citrix Micro VPN SDK. This folder has the following directory structure.

    Directory Structure

  2. Open your Android App project in an IDE. Update app’s build.gradle to add the below six external properties. Change the values of those properties as required.

    ext {
        mvpnSdkLib = "<Enter mVPN Sdk folder location>/mVPNSDK/Library"
        keyStorePath = "<Enter release keystore path here>"
        keystorePassword = "<Enter Store Password Here>"
        keyAlias = "<Enter Key Alias Here>" 
        keyPassword = "<Enter Key Password Here>"
        packageName = "<Enter App Package Name>"
    }
    
  3. Add repository url to point to mVPN SDK library.

    repositories {
        maven { url "file://${project.ext.mvpnSdkLib}" }
    }
    

    Alternatively, if you want to use a remote repo then upload these four aar libraries under mVPNSDK/Library folder into a remote repo. mvpnsdk.aar, authsdk.aar, configsdk.aar, loggersdk.aar. If you don't want to use any local/remote repo then you can directly add these four libraries into your project's libs folder and add those aar files as implementation dependency in build.gradle.

  4. Add a Gradle dependency in your app’s build.gradle to use MVPN SDK library.

    dependencies {
        implementation "com.citrix.mvpn:mvpnsdk:19.4.0"
        }
    
  5. Enable desugaring by adding the following to build.gradle.

    android {
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
    }
    
  6. Add signingConfigs in your build.gradle. Enter correct keystore path, store password, key alias, and key password.

    android {
        signingConfigs {
    
            debug {
                storeFile file(project.ext.keyStorePath)
                storePassword "$project.ext.keystorePassword"
                keyAlias "$project.ext.keyAlias"
                keyPassword "$project.ext.keyPassword"
            }
            release {
                storeFile file(project.ext.keyStorePath)
                storePassword "$project.ext.keystorePassword"
                keyAlias "$project.ext.keyAlias"
                keyPassword "$project.ext.keyPassword"
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
            debug {
                signingConfig signingConfigs.debug
            }
        }
    }
    
  7. Add below Gradle task for generating MDX file from APK and finalize build with task generateMdx

    task generateMdx(type: Exec, dependsOn: build) {
        commandLine 'java', '-jar', "${project.ext.mvpnSdkLib}/tools/managed-app-utility.jar", 'wrap',
        '-in',          "$buildDir/outputs/apk/release/${project.name}-release.apk",
        '-out',         "$buildDir/outputs/apk/release/${project.name}.mdx",
        '-appType',     'sdkapp',
        '-storeUrl', "https://play.google.com/store/apps/details?id=${project.ext.packageName}",
        '-keystore',    "${project.ext.keyStorePath}",
        '-storepass',   "${project.ext.keystorePassword}",
        '-keyalias',    "${project.ext.keyAlias}",
        '-keypass',     "${project.ext.keyPassword}"
    }
    build.finalizedBy generateMdx
    
  8. If your App has proguard settings enabled, then add the following in your proguard file.

    -keep class com.citrix.** {*;}
    -keepattributes Exceptions
    
  9. Once Gradle build completes. It generates an MDX file under the apk folder. Step 7 generates the MDX file. If you are using SampleCode then output MDX file name is mvpntestapp.mdx.

  10. Upload this MDX file to XMS console. This step allows the app to be managed through XenMobile.

    XMS Upload 1

    XMS Upload 2

    If you are using split tunnel mode REVERSE then you can define Reverse Split Tunnel Exclusion List under MDX Policies. Also, you can override the default log settings under MDX Policies.

  11. Install Secure Hub version 19.3.5+ from Google Play Store.

  12. Launch Secure Hub. Enroll to the XenMobile environment.
  13. Install the SDK app (for example MvpnTestApp) from SecureHub Store page. Click Add. If this app does not exist in play store then side load the apk file.
    adb install -r mvpntestapp.apk