本文整理汇总了Java中com.dropbox.core.DbxOAuth1AccessToken类的典型用法代码示例。如果您正苦于以下问题:Java DbxOAuth1AccessToken类的具体用法?Java DbxOAuth1AccessToken怎么用?Java DbxOAuth1AccessToken使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbxOAuth1AccessToken类属于com.dropbox.core包,在下文中一共展示了DbxOAuth1AccessToken类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import com.dropbox.core.DbxOAuth1AccessToken; //导入依赖的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);
}
}