本文整理汇总了Java中com.dropbox.client2.android.AndroidAuthSession.setAccessTokenPair方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidAuthSession.setAccessTokenPair方法的具体用法?Java AndroidAuthSession.setAccessTokenPair怎么用?Java AndroidAuthSession.setAccessTokenPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dropbox.client2.android.AndroidAuthSession
的用法示例。
在下文中一共展示了AndroidAuthSession.setAccessTokenPair方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadAuth
import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
protected void loadAuth(AndroidAuthSession session) {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(mContext);
String key = prefs.getString(ACCESS_KEY_NAME, null);
String secret = prefs.getString(ACCESS_SECRET_NAME, null);
if (key == null || secret == null || key.length() == 0
|| secret.length() == 0)
return;
if (key.equals("oauth2:")) {
// If the key is set to "oauth2:", then we can assume the token is
// for OAuth 2.
session.setOAuth2AccessToken(secret);
} else {
// Still support using old OAuth 1 tokens.
session.setAccessTokenPair(new AccessTokenPair(key, secret));
}
}
示例2: loadAuth
import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
private void loadAuth(AndroidAuthSession session) {
SharedPreferences prefs = mContext.getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
String key = prefs.getString(ACCESS_KEY_NAME, null);
String secret = prefs.getString(ACCESS_SECRET_NAME, null);
if (key == null || secret == null || key.length() == 0 || secret.length() == 0)
{
Log.d(TAG,"No key found");
return;
}
if (key.equals("oauth2:")) {
// If the key is set to "oauth2:", then we can assume the token is for OAuth 2.
Log.d(TAG,"OAuth 2 token found");
session.setOAuth2AccessToken(secret);
} else {
// Still support using old OAuth 1 tokens.
Log.d(TAG,"OAuth 1 keypair found");
session.setAccessTokenPair(new AccessTokenPair(key, secret));
}
}
示例3: loadAuth
import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
/**
* Shows keeping the access keys returned from Trusted Authenticator in a local
* store, rather than storing user name & password, and re-authenticating each
* time (which is not to be done, ever).
*/
private void loadAuth(AndroidAuthSession session) {
SharedPreferences prefs = activity.getSharedPreferences("ACCOUNT_PREFS_NAME", 0);
String key = prefs.getString(DROPBOX_PREFKEY_NAME, null);
String secret = prefs.getString(DROPBOX_PREFKEY_SECRET, null);
if (key == null || secret == null || key.length() == 0 || secret.length() == 0) return;
if (key.equals("oauth2:")) {
// If the key is set to "oauth2:", then we can assume the token is for OAuth 2.
session.setOAuth2AccessToken(secret);
} else {
// Still support using old OAuth 1 tokens.
session.setAccessTokenPair(new AccessTokenPair(key, secret));
}
}