@SuppressWarnings({"deprecation", "unchecked"}) @Override public String[] doInBackground(Void... params) { Log.i(TAG, "accessing social service"); try { String userName = AccountSetting.getInstance().getUsername(); String password = AccountSetting.getInstance().getPassword(); URL url = new URL(SocialActivityUtil.getDomain()); Log.i(TAG, "userName: "******"url: " + url.toString()); SocialClientContext.setProtocol(url.getProtocol()); SocialClientContext.setHost(url.getHost()); SocialClientContext.setPort(url.getPort()); SocialClientContext.setPortalContainerName(ExoConstants.ACTIVITY_PORTAL_CONTAINER); SocialClientContext.setRestContextName(ExoConstants.ACTIVITY_REST_CONTEXT); SocialClientContext.setUsername(userName); SocialClientContext.setPassword(password); ClientServiceFactory clientServiceFactory = ClientServiceFactoryHelper.getClientServiceFactory(); VersionService versionService = clientServiceFactory.createVersionService(); SocialClientContext.setRestVersion(versionService.getLatest()); clientServiceFactory = ClientServiceFactoryHelper.getClientServiceFactory(); mActivityService = clientServiceFactory.createActivityService(); mIdentityService = clientServiceFactory.createIdentityService(); mSpaceService = clientServiceFactory.createSpaceService(); mUserIdentity = mIdentityService.getIdentityId(ExoConstants.ACTIVITY_ORGANIZATION, userName); RestIdentity restIdent = mIdentityService.getIdentity(ExoConstants.ACTIVITY_ORGANIZATION, userName); RestProfile profile = restIdent.getProfile(); String[] profileArray = new String[2]; profileArray[0] = profile.getAvatarUrl(); profileArray[1] = profile.getFullName(); return profileArray; } catch (SocialClientLibException e) { Log.d(TAG, "SocialClientLibException: " + e.getLocalizedMessage()); return null; } catch (RuntimeException e) { Log.d(TAG, "RuntimeException: " + e.getLocalizedMessage()); return null; } catch (MalformedURLException e) { Log.d(TAG, "MalformedURLException: " + e.getLocalizedMessage()); return null; } }
/** {@inheritDoc} */ @Override protected void setRestVersion() { SocialClientContext.setRestVersion("v1-alpha2"); }