Introduction
If you are building a custom Android application for your media players, you may want to pass specific settings, like a custom server URL or string, directly from your management platform.
This article explains how to easily send and retrieve custom data using a built-in INI parameter.
Prerequisites
- This article assumes that the device's set up has been completed and the device is configured to use Orchestrate, USB, or DHCP to receive configuration settings.
- The article also assumes that you understand the use of Amino INI configuration settings and that you can edit and apply INI configuration parameters to your media player.
- You must have a basic understanding of Android development, have downloaded the Apollo SDK from the Enable Enterprise Development page and imported it into your Android project.
Summary
To pass custom data to your application, you will need to set the INI parameter tvapp.mw_args, make sure your app has the correct permissions, and read the value using the Amino SDK.
1. Set the parameter in your configuration
Using your management platform (such as Orchestrate, or a local boot.ini file), add the following parameter:
tvapp.mw_argsValue: enter the URL, string, or JSON data you want your app to receive.
- Save your changes and reboot the media player.
Tip: you can verify that the media player successfully received the parameter by connecting to the device via ADB and running the command: device_param -l. Your parameter and its value should be listed in the output.
2. Add the required permissions to your app
To allow your application to read device configurations, you must declare specific Amino permissions in your AndroidManifest.xml file. Add the following lines:
<uses-permission android:name="com.aminocom.device.permission.MANAGE_DEVICE" />
<uses-permission android:name="com.aminocom.device.permission.READ_DEVICE_CONFIG" />
3. Read the parameter in your Java code
Inside your code, use the SystemUtil class from the com.aminocom.libplayer package to read the value.
Because system services can take a moment to load, you must use an observer to check if the service is ready before grabbing the data. Here is a simplified example of how to implement it:
import com.aminocom.libplayer.SystemUtil;
SystemUtil systemUtil = new SystemUtil(context);
SystemUtil.setObserver(activity, isReady -> {
if (isReady) {
// Retrieve the INI value. "null" is the default fallback if the parameter is empty.
String jsonString = systemUtil.getIni("tvapp.mw_args", "null");
Log.d("TAG", "My custom settings: " + jsonString);
} else {
Log.d("Client", "Service not ready yet");
}
});
References
For more details on developing applications and using our SDK, check out the following resources:
- Developing your First Application for an Amino Media Player
- Developer Resources
- Amino Enable Enterprise Development Area
- Player Service API