Kony Fabric console User Guide: SDKs > Android SDK > Initializing the Android Client SDK

Initializing the Android Client SDK

Initialize client with the following code, and start using the services provided in . The initialization method fetches the configuration from and saves it in the cache. Later, the application uses the cached configuration. It is a synchronous call.

When SDK is initialized, the Kony SDK registers a session and sends its information to the Kony Fabric Server. If the device is offline, or the server is not reachable, the session information persists on the device until it can successfully send the information to the Kony Fabric server.

For more information on application session, refer Standard Report Docs.

Note: The sessions created by Native Fabric SDKs are interactive.

Import the following Libraries:

init

 //Sample code to initialize  ClientKonyClient myClient = new KonyClient();
String appkey = "<your-app-key>";
String appsecret = "<your-app-secret>";
String serviceURL = "<your-service-url>";
Context context = getApplicationContext();
try {
    myclient.initAsync(getApplicationContext(), appkey, appsecret, serviceURL new InitCallback() {
        @Override
        public void onSuccess(JSONObject response) {
            Log.d("Init", "Success");
        }
        @Override
        public void onFailure(KonyException error) {
            Log.d("Init", "Failure");
        }
    });
} catch (KonyException exception) {
    Log.d("Init", "Exception");
}

If you are using an untrusted self-signed (SSL) certificate with installation, by default native apps do not allow untrusted SSL certificates for HTTPS connection.

To make your native apps work with untrusted SSL certificates, call the following API:

KonyClient.acceptSelfSignedCertificates();

Note: Once a user calls the KonyClient.acceptSelfSignedCertificates(); API, a native application will accept SSL certificates throughout the app life cycle. A user cannot disable the API from a native app running on a device.

Copyright © 2020 Kony, Inc. All rights reserved.