本文整理汇总了Java中com.tencent.connect.UserInfo.getUserInfo方法的典型用法代码示例。如果您正苦于以下问题:Java UserInfo.getUserInfo方法的具体用法?Java UserInfo.getUserInfo怎么用?Java UserInfo.getUserInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.connect.UserInfo
的用法示例。
在下文中一共展示了UserInfo.getUserInfo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
private void getUserInfo(JSONObject response) {
Activity activity = getActivity();
if(activity == null ){
onLoginFailed("activity = null");
return ;
}
UserInfo info = new UserInfo(activity, mTencent.getQQToken());
info.getUserInfo(new UiListenerImpl() {
@Override
public void onComplete(Object o) {
JSONObject json = (JSONObject)o;
try {
json.put(OPEN_ID, mTencent.getOpenId());
json.put(ACCESS_TOKEN, mTencent.getAccessToken());
} catch (JSONException e) {
}
sUserInfo = json.toString();
onLoginSuccess(json);
/* if(json.has("figureurl")){ //头像地址
Bitmap bitmap = Util.getbitmap(json.getString("figureurl_qq_2"));
}*/
}
});
}
示例2: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
public static void getUserInfo(Activity activity,IUiListener listener) {
if (api == null) {
api = Tencent.createInstance(APP_ID, MainApp.getContext());
}
if(api==null){
return;
}
QQToken token=api.getQQToken();
UserInfo info = new UserInfo(activity, token);
info.getUserInfo(listener);
}
示例3: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
public static void getUserInfo(Context context, String appId, SocialToken token, IUiListener listener) {
//这里只是为了在刷新用户信息的时候,设置一下全局变量。场景:APP升级安装,没有重新登录过程,调用该接口刷新用户信息,
//如果没有该过程刷新Global.getContext()等常量,会出现空指针
getTencentInstance(context, appId);
if (SocialSSOProxy.isTokenValid(context)) {
UserInfo info = new UserInfo(context, parseToken(appId, token));
info.getUserInfo(listener);
}
}
示例4: getQQUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
/**
* 获取用户的QQ基本信息,请在授权成功后调用此方法获取QQ信息
*
* @param context
* @param mDataListener
*/
public static void getQQUserInfo(Context context,
final QQGetDateListener mDataListener) {
if (mTencent != null && mTencent.isSessionValid()) {
IUiListener listener = new IUiListener() {
@Override
public void onError(UiError arg0) {
if (mDataListener != null) {
mDataListener.onError(arg0);
}
}
@Override
public void onComplete(Object response) {
if (mDataListener != null) {
mDataListener.onComplete((JSONObject) response);
}
}
@Override
public void onCancel() {
if (mDataListener != null) {
mDataListener.onCancel();
}
}
};
mInfo = new UserInfo(context, mTencent.getQQToken());
mInfo.getUserInfo(listener);
}
}
示例5: updateUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
private void updateUserInfo() {
if (mTencent != null && mTencent.isSessionValid()) {
IUiListener listener = new IUiListener() {
@Override
public void onError(UiError e) {
}
@Override
public void onComplete(final Object response) {
msg=new Message();
msg.what=3;
msg.obj=response;
handler.sendMessage(msg);
if (progressDialog!=null){
progressDialog.dismiss();
}
}
@Override
public void onCancel() {
}
};
mInfo = new UserInfo(this, mTencent.getQQToken());
mInfo.getUserInfo(listener);
}
}
示例6: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
/**
* 获取三方登陆用户的信息
* @param activity
* @param listener
* @param qqToken
*/
public static void getUserInfo(Activity activity, final OauthLoginListener listener, final QQToken qqToken) {
UserInfo userInfo = new UserInfo(activity, mTencent.getQQToken());
userInfo.getUserInfo(new IUiListener() {
@Override
public void onComplete(Object o) {
try {
JSONObject jsonData = (JSONObject) o;
KLog.json("qq-user", jsonData.toString());
QQUserInfo qqUserInfo = new QQUserInfo();
qqUserInfo.gender = jsonData.getString("gender");
qqUserInfo.nickname = jsonData.getString("nickname");
qqUserInfo.figureurl_qq_1 = jsonData.getString("figureurl_qq_1");
qqUserInfo.figureurl_qq_2 = jsonData.getString("figureurl_qq_2");
if ((qqUserInfo != null) && (qqUserInfo.nickname != null)) {
qqToken.authtype = 3;
qqUserInfo.authtype = 3;
listener.OauthLoginSuccess(qqToken, qqUserInfo);
}
} catch (JSONException e) {
e.printStackTrace();
listener.OauthLoginFail();
}
}
@Override
public void onError(UiError uiError) {
listener.OauthLoginFail();
}
@Override
public void onCancel() {
listener.OauthLoginFail();
}
});
}
示例7: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
public void getUserInfo() {
/* Observable.create(new ObservableOnSubscribe<UserInfo>() {
@Override
public void subscribe(ObservableEmitter<UserInfo> e) throws Exception {
UserInfo userInfo = new UserInfo(LoginActivity.this, mTencent.getQQToken());
userInfo.getUserInfo(listener);
e.onNext(userInfo);
}
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<UserInfo>() {
@Override
public void accept(UserInfo s) throws Exception {
Log.e(MainActivity.TAG, "accept: " + s);
}
});*/
if (mTencent != null && mTencent.isSessionValid()) {
IUiListener listener = new IUiListener() {
@Override
public void onError(UiError e) {
}
@Override
public void onComplete(Object response) {
Log.e(MainActivity.TAG, "onComplete: "+response.toString() );
}
@Override
public void onCancel() {
}
};
UserInfo mInfo = new UserInfo(this, mTencent.getQQToken());
mInfo.getUserInfo(listener);
} else {
Log.e(MainActivity.TAG, "getUserInfo: 获取失败");
}
}
示例8: getTencentUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
/**
* 获取Tencent user info
*/
private void getTencentUserInfo() {
if (ready()) {
loginLoading.setVisibility(View.VISIBLE);
mTencentInfo = new UserInfo(this, mTencent.getQQToken());
//mTencentInfo.getUserInfo(new UserInfoUIListener(this,"get_simple_userinfo"));
mTencentInfo.getUserInfo(new IUiListener() {
@Override
public void onComplete(Object response) {
Log.d(TAG, "UserInfoUIListener onComplete:");
loginLoading.setVisibility(View.GONE);
if (null == response) {
SnackbarUtil.showSnackBar(getWindow().getDecorView(), getResources().getString(R.string.snack_message_login_failure));
return;
}
JSONObject jsonResponse = (JSONObject) response;
if (null != jsonResponse && jsonResponse.length() == 0) {
SnackbarUtil.showSnackBar(getWindow().getDecorView(), getResources().getString(R.string.snack_message_login_failure));
return;
}
Log.d(TAG, "UserInfoUIListener onComplete:" + ((JSONObject) response).toString());
try {
JSONObject jsonObject = (JSONObject) response ;
String avatar = jsonObject.getString("figureurl_qq_2") ;
String screenName = jsonObject.getString("nickname") ;
saveUserInfo(avatar,screenName,mTencent.getOpenId(),null);
launch(AuthLogin.this, Intent.FLAG_ACTIVITY_CLEAR_TOP, MainActivity.class);
} catch (Exception e) {
SnackbarUtil.showSnackBar(getWindow().getDecorView(), getResources().getString(R.string.snack_message_login_failure));
}
}
@Override
public void onError(UiError uiError) {
Log.d(TAG, "UserInfoUIListener onError:" + uiError.errorDetail);
loginLoading.setVisibility(View.GONE);
SnackbarUtil.showSnackBar(getWindow().getDecorView(), getResources().getString(R.string.snack_message_login_error) + uiError.errorMessage);
}
@Override
public void onCancel() {
Log.d(TAG, "UserInfoUIListener onCancel:");
loginLoading.setVisibility(View.GONE);
SnackbarUtil.showSnackBar(getWindow().getDecorView(), getResources().getString(R.string.snack_message_login_cancel));
}
});
}
}
示例9: getUserInfo
import com.tencent.connect.UserInfo; //导入方法依赖的package包/类
public static void getUserInfo(Context context, String appId, SocialToken token,
IUiListener listener) {
UserInfo info = new UserInfo(context, parseToken(appId, token));
info.getUserInfo(listener);
}