How to connect Kony Mobile Fabric in Android Native?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

I'm trying to connect Mobile Fabric using Android Native. But the Kony Mobile Fabric init is not getting initialized. It is not executing initSuccesscallback and initfailurecallback and not even returning any error KonyFabric initialization as well. I couldn't proceed

I've taken the code from Fabric project under android tab

try {

konyClient = new KonyClient();

konyClient.initAsync(context, appKey, appSecret, serviceURL,

new InitCallback() {

@Override

public void onSuccess(JSONObject result) {

//Init Success

try {

getFoxNews();

}catch(KonyException konyEx){

// Toast.makeText(this, "Not Working" + konyEx.getErrorDetails(), Toast.LENGTH_SHORT).show();

}

Log.d("Init","Success");

}

@Override

public void onFailure(KonyException exception) {

//Init Failure

Toast.makeText(getApplicationContext(), exception.getErrorDetails(), Toast.LENGTH_SHORT).show();

Log.d("Init","failure");

}

});

}

catch (KonyException exception) {

Log.d("Init","Exception");

Toast.makeText(getApplicationContext(), exception.getMFCode(), Toast.LENGTH_SHORT).show();

}

hi

Please read the documenation how to use Mobile fabric android SDK

http://docs.kony.com/konylibrary/konyfabric/kony_fabric_user_guide/Default.htm#Android/Installing_Android_SDK.htm%3FTocPath%3DSDKs%7CAndroid%7C_____0

Hi,

Even in documentation the same code has been given. But there is no luck. In my code, i've added some extra toast.

//Sample code to initialize Client

KonyClient 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");

}

Thanks,

String appkey = "<your-app-key>";

String appsecret = "<your-app-secret>";

String serviceURL = "<your-service-url>";

appkey , app secret key you have to get it form Mobile Fabric console . Service URL the

you have to pass the url you hit form the mobile device to mobile fabric console .

/Sample code to initialize Client

KonyClient myClient = new KonyClient();

String appkey = "<your-app-key>";

String appsecret = "<your-app-secret>";

String serviceURL = "<your-service-url>";

Context context = getApplicationContext();

  1. /**
  2. * Kony Fabric is auto initialized, only if the Kony Fabric app is linked in the Kony Visualizer.
  3. * In all other cases the Kony Fabric initialization code should be written by customer.
  4. */
  5. Context context = getApplicationContext();
  6. String appKey = "2a086baf7a5a640943211442197ec1f4";
  7. String appSecret = "201534454762d21717ce8a9d33e3501a";
  8. String serviceURL = "https://100003520.auth.konycloud.com/appconfig";
  9. try {
  10. KonyClient konyClient = new KonyClient();
  11. konyClient.initAsync(context, appKey, appSecret, serviceURL,
  12. new InitCallback() {
  13. @Override
  14. public void onSuccess(JSONObject result) {
  15. //Init Success
  16. }
  17. @Override
  18. public void onFailure(KonyException exception) {
  19. //Init Failure
  20. }
  21. });
  22. }
  23. catch (KonyException exception) {
  24. Log.d("Init","Exception");
  25. }

**Image removed for security reasons**

Go to Mobile fabric console click on ... icon you can get the same code to connect for respective platform or you can click on key symbol , where you can find app key , secret URL .

Hi,

I've just shown the sample from link. But i did taken the appSecret, appkey and serviceURL from application and tried it. It is not working and it doesn't gives me any error. Please let me know is there any way to troubleshoot this?

Please check the code below

String appKey = "e6f1c8a59e5bffba455142be3e19b3e";

String appSecret = "cd61588fdf0e996ef961229dc2b653b5";

String serviceURL = "https://100023294.auth.konycloud.com/appconfig";

try {

konyClient = new KonyClient();

konyClient.initAsync(context, appKey, appSecret, serviceURL,

new InitCallback() {

@Override

public void onSuccess(JSONObject result) {

//Init Success

try {

getFoxNews();

}catch(KonyException konyEx){

// Toast.makeText(this, "Not Working" + konyEx.getErrorDetails(), Toast.LENGTH_SHORT).show();

}

Log.d("Init","Success");

}

@Override

public void onFailure(KonyException exception) {

//Init Failure

Toast.makeText(getApplicationContext(), exception.getErrorDetails(), Toast.LENGTH_SHORT).show();

Log.d("Init","failure");

}

});

}

catch (KonyException exception) {

Log.d("Init","Exception");

Toast.makeText(getApplicationContext(), exception.getMFCode(), Toast.LENGTH_SHORT).show();

}

Thanks,

HI,

String serviceURL = "https://100023294.auth.konycloud.com/appconfig"; you have to type in browser you will get XML page , If not some connectivity issue with the server , In Base camp there

is button Contact Support , Please raise a ticket kony Product Team will help you to resolve your issue .

**Image removed for security reasons**

Hi,

This service url gives me 500 error, but it works in kony visualizer enterprise. The app which has been built on Kony Visualizer enterprise works perfectly fine. Why it is not working in android?

Also the sample code that you provided.

I've tried your service url below in browser.

https://100003520.auth.konycloud.com/appconfig

It gives me the same error.

Thanks,

HI,

Please connect to Kony Product support in base camp you will find the button Contact Support .

Support team will help to resolve this issue .