VMIX Blog

Decoupling the Presentation Layer and Data Services with Android Services

 
This week we’re very happy to be open sourcing our first version of an SDK for Android development, along with a demo video-gallery application using that SDK.

Similar to the mobile development kit for iPad and iPhone, released a couple months back, the goal for this release was to provide the core set of objects and components required to power video applications on the Android platform, and to make it easy for developers to use by decoupling the presentation layer from the data services.

This decoupling allows the developer to focus on the UI design and interaction of the application, without having to worry about the details of accessing data from web services, document parsing, request optimization, error handling, and so on. We leverage powerful Android components to achieve this decoupling, the most important of which is probably the Android Service.

A Service is an application component that runs in the background. It can be used to perform long-running operations without interacting with the user, or supply functionality of one application to other applications. The SDK introduces 3 services that extend the base Service; GetCollectionsService, GetCollectionMediasService and PlayVideoService. These Services handle their own thread management to provide non-UI blocking interactions with the VMIX APIs, and parse the response into declared VMIX data structures for UI consumption.

When the operation is completed, the Services use Intents, an inter-application message-passing framework, to alert the UI that the data is now available for presentation. The UI — or with Android specifically, the Activity — that wishes to leverage one of these Services would simply start the Service, and filter on the Intent that announces the availability of data or completion of the operation. Receiving the proper Intent would lead to an update of the presentation.

In addition to providing functionality to the Activity that started them, these Services can also be made available to other applications. This is achieved by directly binding Activities to Services using ServiceConnection. Once the binding is established, the public functionality of these Services is available to be accessed by other application Activities.

You can see the inner workings of these Services and how they’re utilized by downloading the source for the Android SDK and VMIX Demo Application (code named Moonlight). We would love to answer questions and hear any feedback you may have!
 

About Lei Pan

As Senior Director of Engineering, Lei leads a diverse team of engineers at VMIX.
This entry was posted in Featured, Industry News, Products, Tech and tagged , , , , . Bookmark the permalink.

Leave a Reply