Developing Android apps
You can use the XenMobile API in your mobile apps to allow the apps to interact with Citrix Endpoint Management. This article describes how to integrate the MDX App SDK into your app library and the steps required to test, certify, and publish your apps.
How to use the MDX App SDK
Here are some examples of how you might use the APIs.
You can control whether your app allows access to certain features or actions based on whether API calls indicate that the app is managed or wrapped. For example, if an app is not managed or wrapped, you might allow a user access to all features and actions. If an app is wrapped but not managed, you might then restrict certain features or actions. If an app is wrapped and managed, you might put additional restrictions on the app.
Suppose that you want to display a notification to users if a Citrix Endpoint Management administrator sets the Require WiFi policy to On, which means that the app is allowed to run on a wireless network. You can use the API to look up the policy setting and then base your code changes on the policy value.
Perform actions based on custom policies
You can use the APIs to read custom policies in your apps. For example, suppose that you want to enable Citrix Endpoint Management administrators to display a notification in the app. To do that, you can create a custom policy that is empty by default or contains a system message that is supplied by an administrator in the Citrix Endpoint Management console. When your app is managed, it can detect when the Citrix Endpoint Management administrator changes the policy value. If the policy value contains a message, your app displays the notification.
For API definitions, see API for Android.
Integrating the SDK into your app library by using Android Studio and Gradle
To add the MDX App SDK to your Android apps, you import or copy the MDX App Java libraries into your app, as described in this section. The steps are based on Android Studio and the Gradle build system. Going through the steps adds the MDX Apps SDK library to your application so that its classes and methods are accessible to the app.
If you haven’t already installed the latest MDX Toolkit, do so now.
Log on to the Citrix Endpoint Management downloads page.
Expand XenMobile Apps and MDX Toolkit
Locate the MDX Toolkit version you want to install and then click its link to begin the download.
Open MDXToolkit.mpkg with the macOS Finder tool on macOS 10.9.4 or later and Xcode 5.1 or later.
The installation path is Applications/Citrix/MDXToolkit.
The MDX App SDK files are in Applications/Citrix/MDXToolkit/data/MDXSDK_Android.
After installing the MDX Toolkit, install Android Studio from the Android developers website and then do the following:
In the project directory, create a folder named libs.
Add the file worxsdk.aar to the libs folder.
Edit the project “build.gradle” to add a rule to search the libs folder as a repository and to include worxsdk.aar from the libs folder as a dependency.
Build your APK file.
An example of worxsdk.aar:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
The OpenSSL library might cause conflicts with similar libraries in Android apps. Citrix recommends that you use the Citrix versions of the libraries to avoid conflicts.
Publishing an Android app
After you add the MDX App SDK to an Android app, perform the following steps to wrap, test, certify, and publish the app. When wrapping apps by using the command-line interface, include one of the following options:
- –appType Enterprise
- -appType Premium
- -appType General
The default is –appType Enterprise. Use the following guidelines to select the appType:
- Enterprise: Apps require installing Secure Hub on the user device. Also, you must also publish the application in StoreFront and install the app through Secure Hub.
- General: ISV Apps can run without Secure Hub (initially). The application can transition to managed mode when the app detects Secure Hub on the user device and if you publish a matching app. When running as a managed app, General apps behave the same as Enterprise apps. When running as an unmanaged app, Citrix policies are not enforced.
- Premium: ISV apps can run without Secure Hub installed on the user device (initially). The app can transition to a managed app if it detects Secure Hub on the user device and if you publish a matching app. When the app runs unmanaged, MDX enforces some policies, such as the containment policies (allowing network access, screen capture, or blocking the camera).
If you need to upload the wrapped .apk file to an app store or web server, and you already know the URL, add the -storeURL option. You can also add the URL later, as indicated later in these steps.
The MDX Toolkit outputs a modified .apk file and a .mdx file. You will use those files in the following steps. Use the MDX Toolkit to wrap the .apk file for the app. For details, see Wrapping Android Mobile Apps in the MDX Toolkit documentation. That article includes all wrapping commands, including those specific to ISV apps.
The option to wrap ISV apps by using the MDX Toolkit user interface no longer available. You must wrap ISV apps by using the command line.
Install the modified .apk file on an Android device to verify all app functions.
Use the Citrix Endpoint Management console to add the .mdx file to Citrix Endpoint Management and deliver it to an Android device for testing. For details, see To add an MDX app to Citrix Endpoint Management. On that device, test the MDX functionality of your app.
If you added custom policies, be sure to verify that those policies appear in the Citrix Endpoint Management console and work as expected. If you changed default_sdk_policies.xml, test those changes. For details about adding policies and changing policy defaults, see Policy defaults and custom policies.
Fix any issues found in your app, regenerate the app .apk file, and wrap the app again with the MDX Toolkit.
Submit the original .apk file (not the one output by the MDX Toolkit) to Citrix for validation and certification.
After Citrix certifies your app, submit the .apk file generated by the MDX Toolkit to the Google Play Store for approval.
After Google approves your app, run the MDX Toolkit to update the app download URL in the .mdx file. An example command that changes the URL is as follows:
java -jar /Applications/Citrix/MDXToolkit/ManagedAppUtility.jar
Provide the final .mdx file to a Citrix Endpoint Management administrator, who will add it to Citrix Endpoint Management and publish it to users. Or, to make your app available for wider distribution, you can list your MDX verified app in the Citrix Ready Marketplace. For details, see Citrix Ready Verified Program.
The Citrix Endpoint Management software changes significantly between releases. To take advantage of the latest features and bug fixes, you must use the latest version of the MDX Toolkit to wrap your app. Be sure to wrap your original .ipa or .apk file, not the modified file that was previously generated by the MDX Toolkit.
Be sure to use the corresponding version of the MDX App SDK.