Getting Started Guide with RidgeRun's Mobile Framework for Android

From RidgeRun Developer Wiki

Introduction

This wiki is intended to guide the reader in the process of using the RidgeRun's Mobile Framework in Android applications. The user must have read and mastered these wikis:

Android Environment and Set Up

Getting Started with Android Development

Android Basic Library Creation and Usage

Framework final use

The Mobile Framework that RidgeRun provides is intended to be used as a Multimedia framework, GStreamer-based, to support common multimedia operations such as streaming, hardware decoding, video visualization and rendering among others. Also provides a core functionality to use a MSDN-based Auto discovery service.

Requirements

Usually the needed requirements to use the framework are minimal, but the hardware and software specifications mentioned under 'Hardware' and 'Software' section below are recommended.

Hardware

As the framework is intended to perform multimedia operations that are CPU-intensive, it is recommended to use a high-end phone if possible. If those operations are not going to be used, then phones with lower capabilities can run the framework. It was developed and tested on the mobile phone specification mentioned below.

LG G3

LG G3 Specs

Software

There are some specifications on the Software side that must be met to use the framework adequately.

- The target mobile must have a minimum Android distribution of level 18

- Android Studio version should be 2.0

- Android Studio version must have at least the Android SDK level 23

- The Build Tools Version of Android Studio must be at least 23.0.3

- The minimum Android NDK is version 11.

- The GStreamer SDK for Android should be gstreamer-1.0-arm-1.8.1 at least.

Include the Framework on your own Android application

In order to use the Framework the reader must clone the Mobile-Framework repository by typing:

git clone git@github.com:RidgeRun/Mobile-Framework.git && git checkout develop

The created location will be called DEVDIR from now on

The Framework is initially given in a Library Module that can be inserted on any Android Studio project that complies with the above requirements. The extension of the library is .AAR and it is different from common .JARs in the way that .AAR include resources such as layouts, drawables and others, that .JARs can include.

The last .AAR is found at $DEVDIR/MobileMediaClient/bindings/Android/Releases/Sprint_X/mobilemediaclient-release.aar where higher the X, the newer the release.

Using the library on an application

Once the library is located, you can go to your own application and include it as Library/Module by following the next steps:

1) Go to File -> Project Structure -> Modules window.

2) Press the '+' button on the upper left corner of the window.

3) Select Import .JAR/.ARR package.

4) Navigate through the directories to find $DEVDIR/MobileMediaClient/bindings/Android/Releases/Sprint_X/mobilemediaclient-release.aar

5) Click on finish and verify a folder called mobilemediaclient has been created on the project.

6) Verify that mobilemediaclient is a dependency of the app module by re-doing step 1).

7) On the Modules section of the Window, select app and on the Dependencies Tab verify that there is a space of mobilemediaclient with the Scope in Compile.

8) If the above steps are done then you can start using the Mobile Framework API on the source code of the custom application

Compile the Framework by yourself

If you need to modify the framework to match custom specifications then you need to follow the next steps

1) Locate within the $DEVDIR the project called RRMobile, which should be placed at $DEVDIR/MobileMediaClient/bindings/Android/

2) Open the project with Android Studio by selecting: File -> Open and the path of RRMobile

3) Modify and change the source code to match your requirements.

4) Once you have done the changes, re-compile the mobilemediaclient library by going to the Android Studio's right window that says Gradle, in there you will find 1 item with 3 subitems called RRMobile (root), app and mobilemediaclient. Expand the last, expand Build and double click on Clean and afterwards double click on assembleRelease.

5) Everytime you do a change on the source code, the .AAR needs to be cleaned and created again.

Modify the Mobile-Framework

The framework for Android is developed in two sections: The Binders and the Library. The binders are written in Java language, and they provide the interface to access the methods of the library. This last is written in C using Java Native Interface (JNI) functions. The Binders use the code of this library when they load it using System.Loadlibrary() method. Once the lib is loaded the binded methods of the library can be accessed.

The next wiki shows important aspects about the JNI and how the interaction between native code (C/C++) and Java works:

Java Native Interface (JNI)

It is highly recommended that you read it before modifying the Framework.