Mason Framework

The Mason Framework is designed to give your app privileged abilities on Mason OS.

Releases

Mason Framework Stubs Jar Javadoc Supported Mason OS Version(s)
masonstubs-2.2.0.jar reference-2.2.0.zip 2.2.0

Setup

To begin using the Mason Framework you must include the provided masonstubs.jar in your project. This jar should be placed in your app/libs directory.

Next, you need to declare the library as a dependency in your project’s gradle file at app/build.gradle:

dependencies {
    compileOnly files('libs/masonstubs.jar') // add the mason fw jar - NOTE: update the name to match included file
}

Then, you must declare your usage of the library in your AndroidManifest.xml. Note that this goes within the application tags of your manifest:

<uses-library android:name="masonamerica.platform" />

Finally, register your application to the Mason Platform, include it in a Project configuration, and deploy the configuration to your device.

Usage

The main interface for utilizing the Mason Framework is the MasonFramework class which provides MasonFramework#get(Context, Class) to retrieve a feature vertical API.

An example of retrieving the WindowManagerPrivileged API can be seen below:

WindowManagerPrivileged windowManagerPrivileged = MasonFramework.get(context, WindowManagerPrivileged.class);

From here, you can invoke whatever the given interface provides.

FAQs

I’m getting a ClassNotFoundException when attempting to use Mason Framework

Ensure you have declared your usage of the library in your AndroidManifest.xml:

<uses-library android:name="masonamerica.platform" />

I’m getting a SecurityException when attempting to use Mason Framework

Ensure your application is declared in your Project Configuration and that the project has been deployed to your device. NOTE: For development you only need to deploy a configuration with your application declared once. Then you can use install newer versions of your apk as usual using your development tools without needing to update your APK version in your project config.

How can I determine if my application is running on a Mason device?

The simplest way to determine if your app is running on a Mason device is by checking Build.BRAND:

if (Build.BRAND.equals("Mason")) {
  // running on a Mason device. use Mason Framework APIs
}

How can I use the Mason Framework SDK with an app development framework like Xamarin?

Integrating the Mason Framework stub jar in a Xamarin application requires:

  • Creating a wapper JAR around the masonstubs.jar following the Setup instructions above
  • Creating an Android Bindings Project that includes your wrapper JAR as an EmbeddedJar
  • Adding the Android Bindings Project to your Xamarin application and updating your manifest as mentioned in the Setup instructions above

Reach out to support@bymason.com if you have questions about this process.

App updates are not working as expected

Ensure your APK version code was incremented and the new APK is signed with the same certificate as the old APK.