From: Sunil Kumar K R Date: Thu, 24 Nov 2016 09:40:21 +0000 (+0530) Subject: CloudProvisioningClient Signout bug fixed. updated to call new api X-Git-Tag: 1.3.0~1052^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07876e792d328b11578b0623036d7d71baf52b9b;p=platform%2Fupstream%2Fiotivity.git CloudProvisioningClient Signout bug fixed. updated to call new api Change-Id: I26f60b5ec04583907170ea7c49796b58003e5120 Signed-off-by: Sunil Kumar K R Reviewed-on: https://gerrit.iotivity.org/gerrit/14743 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Reviewed-by: Phil Coval Reviewed-by: Randeep Singh (cherry picked from commit eb98d88a7485ab43639a9fa3789b15e1a836266f) Reviewed-on: https://gerrit.iotivity.org/gerrit/14793 --- diff --git a/android/examples/cloudprovisioningclient/src/main/java/org/iotivity/base/examples/cloudprovisioningclient/CloudProvisioningClient.java b/android/examples/cloudprovisioningclient/src/main/java/org/iotivity/base/examples/cloudprovisioningclient/CloudProvisioningClient.java index 3475d7f..fbfcd71 100755 --- a/android/examples/cloudprovisioningclient/src/main/java/org/iotivity/base/examples/cloudprovisioningclient/CloudProvisioningClient.java +++ b/android/examples/cloudprovisioningclient/src/main/java/org/iotivity/base/examples/cloudprovisioningclient/CloudProvisioningClient.java @@ -150,6 +150,35 @@ public class CloudProvisioningClient extends Activity implements OcAccountManage } } }; + + OcAccountManager.OnPostListener onSignOut = new OcAccountManager.OnPostListener() { + @Override + public synchronized void onPostCompleted(List list, + OcRepresentation ocRepresentation) { + logMessage("signOut was successful"); + runOnUiThread(new Runnable() { + @Override + public void run() { + lyt1.setVisibility(View.GONE); + lyt2.setVisibility(View.GONE); + signinLyt.setVisibility(View.VISIBLE); + } + }); + + } + + @Override + public synchronized void onPostFailed(Throwable throwable) { + logMessage("Failed to signOut"); + if (throwable instanceof OcException) { + OcException ocEx = (OcException) throwable; + Log.e(TAG, ocEx.toString()); + ErrorCode errCode = ocEx.getErrorCode(); + logMessage("Error code: " + errCode); + } + } + }; + OcCloudProvisioning.GetIndividualAclInfoListener getIndividualAclInfoListener = new OcCloudProvisioning.GetIndividualAclInfoListener() { @Override @@ -382,10 +411,7 @@ public class CloudProvisioningClient extends Activity implements OcAccountManage EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP)); } - mAccountManager.signOut(CloudProvisioningClient.this); - lyt1.setVisibility(View.GONE); - lyt2.setVisibility(View.GONE); - signinLyt.setVisibility(View.VISIBLE); + mAccountManager.signOut(settingPreference.getString("accesstoken", ""),onSignOut); } catch (OcException e) { e.printStackTrace(); }