- 28 Sep 2023
- 4 Minutes to read
Android Developer SDK
- Updated on 28 Sep 2023
- 4 Minutes to read
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.
- The device should be enrolled with Scalefusion
- At least one device profile is created
Step 1: Download the SDK zip file
- On Scalefusion Dashboard, navigate to Device Profiles & Policies > Device Profiles
- Create new or edit the existing Android Device Profile
- Navigate to Restrictions > Developer API
- 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:
- libs: Contains the *.aar file that you can import into your project
- MDMSDKSample: A sample Java-based Android project to guide developers on how to access the MDM APIs.
- TestApp: An APK that you can quickly install and try how the SDK works.
- 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:
- 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.
- Next, modify your project-level build.gradle file to include flatDirs so that this project can be imported/used in your app.
- Now, add the library project to your app-level build.gradle dependencies and sync so that the library is imported.
Step 4: Use the APIs inside the app
Process on Dashboard
Once the SDK is integrated into the app, follow these steps on Dashboard:
- Install the application directly on a device that is being managed by Scalefusion or push this application via the Enterprise store on Scalefusion Dashboard.
- Once the application is installed, enable it in Device Profile from Select AppsThe app highlighted in the screenshot below is a sample app
- Now go to Restrictions > Developer API.
- 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.
- 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
- 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
- Click on Update Profile
Accessing the APIs on Device
- 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
- The application has two options using the bottom navigation pattern,
- Device Info: Shows the device & management information
- 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:
- EMM Managed devices
- Lenovo devices that support Lenovo SDK
- Samsung Knox devices
- Support of the latest version of Wingman