Skip to content

Android SDK

This document applies to our SDK version 3 for Android.

Debug

This section describes the steps required to verify that our SDK was integrated correctly with the application.

Debugging the application requires the device under test to be connected to Android Studio, and have access to the Android console log. The access to the logging utility can be achieved from Android Studio or externally from the adb logcat command.

Enable debug messages

In order to print debug messages to the Android console log, you need to instruct our SDK's instance to enable logging. Set the property ConsoleLogLevel to LogLevel.INFO.

PolyNetConfiguration.Builder configurationBuilder = PolyNetConfiguration.builder()
    .setManifestUrl(manifestUrl)
    .setChannelId(name)
    .setApiKey(apiKey)
    .setContext(this)
    .setConsoleLogLevel(PolyNetConfiguration.LogLevel.INFO);

SDK configuration

As explained in our SDK's Configuration section, the build() method will return a PolyNetConfiguration instance, or throw a PolyNetException if any parameter is invalid or missing.

Connection to the SDK

If everything is correct, you should see one the following messages in the log:

  • When connected to fetch content from CDN:
    Connected successfully to the Tracker, with ID = (...). Will fetch from CDN.
  • When connected to fetch content from a peer:
    Connected successfully to the Tracker, with ID = (...). Will fetch from P2P (parent ID = ...).

You can look for the node ID, parent ID on the System73 Dashboard, to verify that those nodes are connected.

Connection with Tracker

If the connection with Tracker cannot be opened due to a malformed apiKey search the console log for: Check your API Key. If problem persists, contact support at support@system73.com., you can handle this PolyNetException with the codes: -600, -601.

Content Manifest

If the content manifest is not reachable by the PolyNet Instance or is not supported, search the log for: Error while getting the local Manifest URL. The original is returned instead. The PolyNet is deactivated., you can handle this PolyNetException with the code: -700.

Issues with Tracker Handshake

If an issue with the Tracker Handshake occurs, search the console log for: The PolyNet SDK is not compatible with the Tracker. Tracker code: *{handshake_rejected_code}*. This may happen in transitions to newer versions. If problem persists, contact support at support@system73.com., you can handle this PolyNetException with the code: -701.

Tracker Metrics

If connection to Tracker Metrics Endpoint fails search the console log for: Error communicating with PolyNet metrics server endpoint. Detail: HTTP code: *{http_status_code}*, URL: *{tracker_metrics_url}*. If problem persists, contact support at support@system73.com, you can handle this PolyNetException with the code: -703.

The trace will contain an embedded exception detailing the network problem that caused it. You should verify that networking is available, and that you are using the correct ApiKey.

If the connection to the Tracker was open, but it was rejected, search the console log for an exception containing the message: Connection to the Tracker was not accepted for channel ID = (...). Please, check that the channel ID is correct.

Make sure you are using the correct channel ID.

SDK's content requests

It is very important to verify that the video player is requesting content from the SDK, and not directly from the Internet.

The following messages should appear in the console's log to ensure the proper operation of our SDK's overlay:

Content request URL = ...

Warning

If there is not even one of them in the log, it means that, the player is not using Our SDK to download content.

Please verify that you initialised the video player with the correct manifest URL, passing the URL from the method polyNet.getLocalManifestUrl().

P2P

You will need to verify that peers are able to connect to each other, look for the following messages in the console's log, that show connections and disconnections from peers:

Connected to P2P parent with ID = ...
Disconnected from P2P parent with ID = ...
Connected to P2P child with ID = ...
Disconnected from P2P child with ID = ...

You can see peers come and go by inspecting the parent ID and child ID on the System73 Dashboard.

Reconnections

If the SDK needs to reconnect to the Tracker, search the console's log for an exception containing the message:Connection to the Tracker was unexpectedly closed.

Tracker Connection Related errors will yield:

Error communicating with Tracker. Description: *{custom_description}*. If the problem persists, contact support at support@system73.com.

you can handle this PolyNetException with the code: -702.

If the SDK is commanded to connect to a different parent by the Tracker, search the console log for one of the following messages:

  • When reconnecting to fetch content from CDN:
    Node is moving, ID = (...). Will fetch from CDN.
  • When reconnecting to fetch content from a peer:
    Node is moving, ID = (...). Will fetch from P2P (parent ID = ...).

You can verify that nodes are connecting by looking for the node ID or the parent ID on the System73 Dashboard.

Example of the whole process

The following is an example of a debugging session where 2 devices are connected, and the operation goes completed successfully:

  1. You need to create an exclusive channel for debugging, which is not used by anyone else. Ensure that no other device is connected to it. You can verify that on the System73 Dashboard.

  2. Connect the first device to the channel. The device should be playing video. Check that its node ID shows up on the System73 Dashboard, connected to the CDN, by looking for the following messages in the console's log:

    Connected successfully to the Tracker, with ID = (...). Will fetch from CDN.
    
    Content request URL = ...
    
  3. Connect a second device. The device should start playing video within a few seconds. It should become a child node of the first device. Check that its node ID shows up on the System73 Dashboard, and that it is connected to the first device. Look for the following messages in the console's log:

    • In the parent's log:

      Connected to P2P child with ID = ...

    • In the child's log:

      Connected successfully to the Tracker, with ID = (...). Will fetch from P2P (parent ID = ...).
      
      Connected to P2P parent with ID = ...
      
      Content request URL = ...