Understanding Mobile Context Awareness

What, How and Why of Mobile Context Awareness

Zameer
Ascentic Technology
4 min readJan 4, 2021

--

Image by Pexels from Pixabay

Introduction

Our mobile devices are very much part of our day to day lives. Mobile devices accompany us in the kitchen, in the library, in the vehicle, in the bed or even when we are hiking through a mountain. Any situation we find ourselves in, mobile devices does what its best at — to provide the suitable and tailored services and information through the Apps whenever we need it.

When a mobile app understands user, situation or combination of any environment variables and provide the suitable services, we call them context-aware mobile apps. Location based service apps are an example of such apps. Since mobile devices are always with us and has powerful sensors and services, a mobile device should be able to establish our context and provide right service at the right time making our life easier with a concern for the mobile device limitations.

Sensors and Services Used

Most commonly used sensor is GPS and services is Location services based on the retrieved GPS data. Any taxi haling app or a map based app will be heavily relying on those sensors. But those aren’t the only sensors and services available in a mobile.

Apart from web services, there can be many third party services (and it’s increasing) used to establish context, examples of some would be

Google maps APIs, Temperature APIs(if sensor isn’t available), Demographics APIs.

Here is an exhaustive list of sensors and one or combinations of which can be used to establish a user’s context:

Sensors accessible in the iPhone

Accelerometer

An accelerometer sensor provides the acceleration of the device

Gyroscope

Gyroscope sensor provides metrics on the orientation of the device. It can sense motion including vertical and horizontal rotation

Magnetometer

Magnetometer is crucial for detecting the relative orientation of your device relative to the Earth’s magnetic north. Compass apps will be using this and even it can be used to see if user is facing some direction, like in a maps app.

Pedometer

Step counter

Altimeter

Getting the relative altitude gain or elevation to an already set altitude.

Location

GPS sensor to get the user location coordinates

Microphone

Can be used to listen to environment to see if the environment is noisy or silent.

Sensors accessible in Android which aren’t in the iPhone

Gravity

Gravity sensor is what Android calls a ‘software sensor’ and calculates its values using more than one hardware sensors like accelerometer and gyroscope.

Ambient Temperature

Getting the environment temperature

Context can be established with one of the above sensors or services (e.g. Location) or even combinations of them (e.g. Time, Location, Temperature) to get the right user context.

More possibilities are available with complex context predictions with machine learning techniques, provided of course, if we can build a data set with a set of variables (e.g. Time and Location, so as to predict the user location on a given time) to train a model.

What are the limitations

Mobile devices can be powerful in its processing power and in features, but it can only perform with limited capabilities. These are the limitations which can come up when establishing the context.

Battery usage

Mobile battery power is not unlimited and every API — web, or Operating system (Android/iOS), everything has a hit on the battery power — some high and some low.

Memory usage

From programming errors to incorrect use of services/APIs can result in memory overuse. If the memory is maxed out, then mobile will become unresponsive and laggy.

Internet Access

Internet can play a bigger role in getting information through web requests and service APIs, e.g. Google location services will be needing internet access to retrieve location information.

How to do it correctly

Establishing the context of a user with concerns to limitations is more of a business problem than a technical one. Following steps can be taken to implement context awareness:

  1. A good starting step would be to find minimum variables necessary to establish the context after refining the requirements.
  2. Accuracy can be calibrated in both mobile development platforms and more accurate readings will consume more battery. If there’s a location tracking feature and if we are to go with highly accurate readings every second, mobile battery will die out very soon. So, based on the requirement we can get accurate readings just once or keep the accuracy to an acceptably minimum level if there’s a tracking feature.
  3. Given there are internet dependent context services, there should be a fall back plan to either force user to make internet available or plan for an offline mechanism (we can also take user inputs to establish context).
  4. Always outsource heavy computations to the backend web services, that way there’s more memory available for the app to use more platform specific features.
  5. Use profilers to test the app for memory consumptions and always keep an eye out for Data usage and Battery Usage. If either of these has an unwarranted spike, it could get out of hand very quickly in the consumer market because there are many types of devices with varying degrees of processing, computing and battery power.

If the users can successfully accomplish the desired task using the app, it’s considered as a win. Context awareness is an idea which a developer can employ to make that task accomplishment easier, faster and fun.

References

Accessible sensors in the iPhone: https://github.com/SensingKit/SensingKit-iOS

Accessible sensors in the Android: https://github.com/SensingKit/SensingKit-Android

Android gravity sensor explanation: https://stackoverflow.com/questions/22102405/accelerometer-vs-gravity-sensor

--

--