Android Developer SDK
  • 28 Sep 2023
  • 4 Minutes to read
  • PDF

Android Developer SDK

  • PDF

Article Summary

In the Developer API section of the Device profile, an MDM SDK is provided that can be used in your enterprise apps to get the device information and perform a wide variety of actions (like launching the wifi screen, toggling mobile data, toggling hotspot etc.) locally on the device. This ensures that the users can perform the actions from inside the app itself, and they do not have to switch explicitly from the internal application to perform such actions.

The document describes what the SDK contains, how it can be integrated into your app and the actions that can be performed once it is integrated.

Prerequisites

  1. The device should be enrolled with Scalefusion
  2. At least one device profile is created

Steps

Step 1: Download the SDK zip file

  1. On Scalefusion Dashboard, navigate to Device Profiles & Policies > Device Profiles
  2. Create new or edit the existing Android Device Profile
  3. Navigate to Restrictions > Developer API
  4. Click on the Download SDK button to download the Scalefusion Developer SDK in zip format to the host computer

Step 2: Extract the downloaded zip file

The zip file contains the following in the SDK package:

  1. libs: Contains the *.aar file that you can import into your project
  2. MDMSDKSample: A sample Java-based Android project to guide developers on how to access the MDM APIs.
  3. TestApp: An APK that you can quickly install and try how the SDK works.
  4. MDM SDK Documentation.pdf: The documentation for MDM API.

Step 3: Integrate the SDK into your app

To integrate the SDK into your application, import/Include the library .aar file in your project and start using the APIs. Follow these steps:

  1. The first step is to copy the MDM SDK aar file from the downloaded zip file (mdm-sdk-1.5-5.aar) to the libs folder in your project. If the libs folder does not exist, you can create one.
  2. Next, modify your project-level build.gradle file to include flatDirs so that this project can be imported/used in your app.
  3. Now, add the library project to your app-level build.gradle dependencies and sync so that the library is imported.
The details are available in the documentation inside the SDK. Refer to the section Integrating the SDK in your app

Step 4: Use the APIs inside the app

Process on Dashboard

Once the SDK is integrated into the app, follow these steps on Dashboard:

  1. Install the application directly on a device that is being managed by Scalefusion or push this application via the Enterprise store on Scalefusion Dashboard.
  2. Once the application is installed, enable it in Device Profile from Select Apps
    The app highlighted in the screenshot below is a sample app
  3. Now go to Restrictions > Developer API.
    1. Select Applications: The Application drop-down contains a list of all allowed apps (enabled in Select Apps). Select the one in which you want to access APIs.
    2. Associate Certificate SHA1: Associate the SHA1 of the signing certificate used to sign the app. This will secure the API calls and allow only if the allowed app is signed with the same certificate. With a Sha1 certificate associated, only apps whose certificate matches are allowed to call the APIs on the device. To associate SHA1, check the box that pre-fills the certificate details if the application is in the enterprise store. Otherwise, the user can manually enter them.
      It is not mandatory to associate SHA1 certificate with the application
    3. Add Application: If you want to use the APIs in more than one application, click on Add Application. This adds another row where you can select the application and associate sha1
  4. Click on Update Profile

Accessing the APIs on Device

  1. Click on the app icon to launch it.
    The app should be set to visible. Only then it will show up on the home screen
  2. The application has two options using the bottom navigation pattern,
    1. Device Info: Shows the device & management information
    2. Actions: Displays the actions that can be performed. Click on an action to perform the action.

Following are the actions which can be performed on supported devices with the MDM SDK APIs:

  • Launch Wi-Fi screen (if policy allows it)
  • Toggle Mobile Data, Hotspot, Flight Mode, Status/Notification bar
  • Install Pending APKs and Local APKs
  • Reboot the device
  • Lock Device: Locks the device screen
  • Lock or Unlock the device. There should be a time gap of 1 hour between locking and unlocking a device or vice-versa.
  • Power off/Shutdown of the device
  • Start Activity
  • Refresh Policies: Refreshes the Scalefusion policies locally. The policies can be refreshed in 15 minutes duration.
  • Clear App Data: Enter the app's package name to clear app data.
  • Uninstall App: Enter the app's package name to uninstall it.
  • Change Date/Time: Allows end users to change date/time
  • Enable or Disable Automatic Timezone
  • Start or Stop Full Screen. For this, Add or remove fullscreen (from the dashboard should be enabled)
  • Enable App: Enter the app package name to enable it and the time duration after which it should be enabled.

Which are the supported devices on which the APIs can be accessed?

Support varies from device to device, and some of these operations are not guaranteed to work on all devices. The MDM app should have support for the actions via any of the following means:

  1. EMM Managed devices
  2. Lenovo devices that support Lenovo SDK
  3. Samsung Knox devices
  4. Support of the latest version of Wingman

Was this article helpful?