public void validateSignedInUser() { if (Jump.getSignedInUser() != null && Jump.getAccessToken() != null) { try { loadLinkedUnlinkedAccounts(); } catch (JSONException e) { Toast.makeText(LinkListActivity.this, "Account LinkUnlink Failed.", Toast.LENGTH_LONG) .show(); } } }
@Override public void jrAuthenticationDidSucceedForLinkAccount( JRDictionary auth_info, String provider) { String token = auth_info.getAsString("token"); link_unlink = true; Jump.performLinkAccount(token, captureApiResultHandler); }
public void loadLinkedUnlinkedAccounts() throws JSONException { Jump.performFetchCaptureData( new Jump.CaptureApiResultHandler() { @Override public void onSuccess(JSONObject response) { ArrayList<LinkData> linkUnlinkResults = new ArrayList<LinkData>(); JSONObject json = response; try { JSONArray profiles = json.getJSONObject("result").getJSONArray("profiles"); for (int i = 0; i < profiles.length(); i++) { JSONObject profileData = profiles.getJSONObject(i); LogUtils.loge(profileData.getString("domain")); LinkData linkedRecords = new LinkData( profileData.getString("identifier"), profileData.getString("domain")); linkUnlinkResults.add(linkedRecords); LogUtils.loge(profileData.getString("identifier")); } mAdapter = new LinkAccountsAdapter(LinkListActivity.this, linkUnlinkResults); link_account.setAdapter(mAdapter); } catch (JSONException e) { LogUtils.loge("Error parsing data " + e.toString()); } } @Override public void onFailure(CaptureAPIError error) { Toast.makeText(LinkListActivity.this, "Account LinkUnlink Failed.", Toast.LENGTH_LONG) .show(); } }); }