Retrieving the INI parameter
INI parameters are stored on apollo device under persistence storage . The keys and value of the parameter can be obtained through pre-loaded Service named IDeviceRemoteService . For custom app , it is required to import the AIDL interface Java Library to communicate with the corresponding android service . To obtain the latest library file , please contact amino support .
Assuming that the latest AIDL library was imported to your android project . You are suggested to create a DeviceClient Class to communicate with the corresponding service . Below is an example :
DeviceClient.java
package tv.amino.testplay;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import com.aminocom.device.IDeviceRemoteService;
public class DeviceClient {
private static final String TAG = DeviceClient.class.getSimpleName();
private static final String DEVICE_REMOTE_SERVICE_PACKAGE = "com.aminocom.device";
private static final String DEVICE_REMOTE_SERVICE_CLASS = DEVICE_REMOTE_SERVICE_PACKAGE + ".DeviceRemoteService";
private static IDeviceRemoteService mService;
private static DeviceRemoteServiceConnection mConnection;
private Context mContext;
public DeviceClient(Context context, DeviceRemoteServiceConnection connection) {
mContext = context;
mConnection = connection;
}
// ----------------------------------------------------------------------
// Code showing how to deal with remote service.
// ----------------------------------------------------------------------
public static class DeviceRemoteServiceConnection implements ServiceConnection {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
Log.d(TAG, "onServiceConnected(): className=" + className);
// This is called when the connection with the service has been
// established, giving us the service object we can use to
// interact with the service. We are communicating with our
// service through an IDL interface, so get a client-side
// representation of that from the raw service object.
mService = IDeviceRemoteService.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName className) {
Log.d(TAG, "onServiceDisconnected(): className=" + className);
// This is called when the connection with the service has been
// unexpectedly disconnected -- that is, its process crashed.
mService = null;
}
}
public static IDeviceRemoteService getService() {
return mService;
}
public static int getVersion() {
return IDeviceRemoteService.VERSION;
}
public void connect() throws Exception {
// Bind remote service on setUp()
Intent intent = new Intent();
intent.setComponent(new ComponentName(DEVICE_REMOTE_SERVICE_PACKAGE, DEVICE_REMOTE_SERVICE_CLASS));
mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
}
public void disconnect() throws Exception {
// Unbind remote service on tearDown()
mContext.unbindService(mConnection);
}
public String getDeviceParameter(final String key, final String def) throws Exception {
return mService.getDeviceParameter(key, def);
}
public String getApplicationParameter(final String key, final String def) throws Exception {
return mService.getApplicationParameter(key, def);
}
public boolean setApplicationParameter(final String key, final String value) throws Exception {
return mService.setApplicationParameter(key, value);
}
public byte[] getEthernetMacAddress() throws Exception {
return mService.getEthernetMacAddress();
}
public String getDeviceSerialNumber() throws Exception {
return mService.getDeviceSerialNumber();
}
public String getDeviceHardwareModel() throws Exception {
return mService.getDeviceHardwareModel();
}
}
AndroidManifest.xml
Your Manifest file required to allow special user permission . Please add :
<uses-permission android:name="com.aminocom.device.permission.MANAGE_DEVICE" />
<uses-permission android:name="com.aminocom.device.permission.READ_DEVICE_CONFIG" />
MainActivity.java
At your MainActivity, you are suggested to define the client , connection class and then make a service connection call under oncreate() . Below is an example :
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
//Definition for Device Client connection
private DeviceClient mClient;
private DeviceClient.DeviceRemoteServiceConnection mConnection = new DeviceClient.DeviceRemoteServiceConnection();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Create Device Client Connection
mClient = new DeviceClient(getApplicationContext(), mConnection);
try {
mClient.connect();
Log.e("start_deviceClient ","starting");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sample Method to get the Device Parameter :
private String Get_Device_Paramater(String parameterKeyStr) {
String parameterValueStr="";
try {
parameterValueStr = mClient.getDeviceParameter(parameterKeyStr, "");
} catch (Exception e) {
e.printStackTrace();
return "";
}
return parameterValueStr;
}
To obtain tvapp.mw_args ,call the following :
String val=Get_Device_Parameter("tvapp.mw_args") ;
Log.e("Getsysteminfo","Device_parameter : " + val);
Expected output :
2022-05-30 15:55:15.921 10289-10289/tv.amino.testplay E/Getsysteminfo: Device_parameter : 10.0.32.61
FYI the INI parameter can be obtained from the adb console : device_param -l
>> device_param -l
[system.disable_rescue]: [0]
[standby.deep_sleep.enable]: [0]
[globalkey.key_action]: [2]
[tvapp.package_id]: [com.aminocom.browser]
[tvapp.mw_args] : [10.0.32.61]
[adb.mode]: [1]