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 sandbox player from player service API at the Enable Enterprise Development page and imported the aar file 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 player service 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 Player Service package visibility
Add the following entry as a direct child of the <manifest> element in your application’s AndroidManifest.xml:
<queries>
<package android:name="com.aminocom.playerservice" />
</queries>
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: