本文整理匯總了Java中com.dropbox.core.DbxOAuth1Upgrader類的典型用法代碼示例。如果您正苦於以下問題:Java DbxOAuth1Upgrader類的具體用法?Java DbxOAuth1Upgrader怎麽用?Java DbxOAuth1Upgrader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DbxOAuth1Upgrader類屬於com.dropbox.core包,在下文中一共展示了DbxOAuth1Upgrader類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onResume
import com.dropbox.core.DbxOAuth1Upgrader; //導入依賴的package包/類
@Override
public void onResume(final FileStorageSetupActivity activity) {
if (activity.getProcessName().equals(PROCESS_NAME_SELECTFILE))
activity.getState().putString(EXTRA_PATH, activity.getPath());
Log.d("KP2AJ", "OnResume (3). LoggedIn="+mLoggedIn);
/*if (mLoggedIn)
{
finishActivityWithSuccess(activity);
return;
}*/
final String[] storedV1Keys = getKeysV1();
if (storedV1Keys != null) {
new AsyncTask<Object, Object, Object>()
{
@Override
protected Object doInBackground(Object... objects) {
DbxOAuth1AccessToken v1Token = new DbxOAuth1AccessToken(storedV1Keys[0], storedV1Keys[1]);
DbxOAuth1Upgrader upgrader = new DbxOAuth1Upgrader(requestConfig, appInfo);
try {
String v2Token = upgrader.createOAuth2AccessToken(v1Token);
upgrader.disableOAuth1AccessToken(v1Token);
storeKey(v2Token);
return v2Token;
} catch (Exception e) {
e.printStackTrace();
clearKeys();
return null;
}
}
@Override
protected void onPostExecute(Object o) {
if (o != null) {
buildSession();
finishActivityWithSuccess(activity);
}
else
resumeGetAuthToken(activity);
}
}.execute();
}
else {
resumeGetAuthToken(activity);
}
}