Network Security Settings

Singleton class

Secure connection

For all the following network configurations take notice that this singleton class should be altered before the SDK initialization procedure. This is not a rule but it will assure that all the connections will be properly secured for that moment on.

NetworkSecuritySettings.getInstance().setHostname("api.example.com")

ArrayList<String> sha256_pins = new ArrayList<>();
sha256_pins.add("EohwrK1N7rr3bRQphPj4j2cel+B2d0NNbM9PWHNDXpM=");
sha256_pins.add("YEnyhAxjrMAeVokI+23XQv1lzV3IBb3zs+BA2EUeLFI=");

NetworkSecuritySettings.getInstance().setPins(sha256_pins);

Its recommended to have at least two different pins so that the application always has a fallback.

Unsecure connections

For testing purposes its possivo to enable http connections discarding all security measures regarding the connection to the API. In this case the developer should ignore the previous subject completly.

NetworkSecuritySettings.getInstance().isConnectionSecured(false);
//By default this paramenter is set to true.

Last updated