Over a million developers have joined DZone.

Building a Mobile Device Management Solution for Android Phones and Tablets

This article looks at Rajat Mehta's approach to Android device monitoring and management, which will prove useful if your device is lost or stolen.

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

One of the traditional ways of building monitoring tools is to deploy a beacon (which is a small piece of software) on the host machine and use the beacon to monitor the performance statistics of the host machine. The beacon can also connect to a few other machines or apps remotely and monitor them.

Generally, these beacons are fed with some metrics they rely on while fetching the statistics from the host machines or apps. Certain rules can be applied to the data that is collected so that things like alerts, reports, etc. can be generated based on them. The beacons also have other uses as well. For example, they can be asked to perform actions like providing support for provisioning, patching, or fetching a location in case the device is lost or stolen.

With the use of new machine-learning technologies applied to the data collected by the beacons, the power of these beacons increases tremendously. Now they can be taught to take intelligent actions based on the data rather than taking actions based only on rules. Building an intelligent beacon for taking unique actions based on machine-learned data will be a separate topic that I will write in another post. In this post, I will cover an approach that can be used for building an MDM (mobile device management) open-source solution for Android phones and tablets using the traditional approach.

Our aim is to provide a solution where a device's health can be continuously monitored, and the user gets exclusive remote access to monitor the health of their android device. 

The project can be divided into three parts :

  • An Android native app: This app contains the metrics for health data collection for the device. The app can be downloaded from the Google Play store. The user will have to do a one-time registration of the device (once the app is first opened) with a backend server. Thereby a direct connection can be made between the app and the backend server and this connection can be stored securely on the device itself.
  • Backend app: This can contain java server side code or any other server side code that handles data collection, data cleansing, data delivery, reporting, or notification features. The app should be capable of collecting the data asynchronously and can be hosted on any cloud solution like Google app engine or AWS. 
  • A web application: This can provide remote access to monitor the health of the android device remotely. It can tell details like the location of the device, current battery status, which apps drained the battery the most in the last few days, usage pattern of the device, etc. If the user forgets the phone somewhere, they can see the last location of the phone on this web app.

The device can be made to take actions if the android app is opened. A push notification is triggered from the backend server and can be sent to the device via Google Cloud Messaging. Upon receiving the message, the command that the backend server sent can be extracted from the message and the android app can act accordingly. If a device is stolen, the user can log in and delete his personal pictures or messages.

Though google currently provides an app that has some of these features, the approach mentioned above can be deployed as a custom BYOD solution internally in small organizations.

Note: The approach mentioned above might be a little dated, as I did this work in open-source sometime back. But the approach still holds good and can still be used. Please feel free to download and use my code from here

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.

mobile,byod,beacons,device manager

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}