To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.

Logs are not usually available in production builds because they are suppressed, or the devices are not connected to a development environment on a PC. The CONNECT Player provides an API for the application to capture, store and display logs.

The log levels set by OTVLog.setLogLevel() apply to both the usual Logcat output and the mechanism described here.

The CONNECT Player SDK provides an interface called IOTVLogProvider that declares a single callback method - void logMessage(String xLog). The String parameter contains a structured log message, equivalent to one line in Logcat.

The application needs to implement and instantiate a version of IOTVLogProvider and its logMessage() callback and provide it to the static OTVLog class.

:
import nagra.otv.sdk.OTVLog;
import nagra.otv.sdk.log.IOTVLogProvider;
:
:
IOTVLogProvider mLogProvider = new IOTVLogProvider() {
    @Override
    public void logMessage(String xLog) {
        // Do something with the logs here
    }
};
:
:
OTVLog.setLogProvider(mLogProvider);
OTVLog.setLogLevel(OTVLog.LOG_LEVEL_DEBUG); // Choose your own level here
:
CODE

It is good practice to handle the messages on a separate thread.