本文整理汇总了Java中com.tencent.connect.UserInfo类的典型用法代码示例。如果您正苦于以下问题:Java UserInfo类的具体用法?Java UserInfo怎么用?Java UserInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserInfo类属于com.tencent.connect包,在下文中一共展示了UserInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: qqLogin
import com.tencent.connect.UserInfo; //导入依赖的package包/类
public static void qqLogin(final BaseActivity activity, final String url, final JsonCallback
callback) {
mTencent.login((Activity) activity, BuildConfig.PLATFORM, new IUiListener() {
public void onComplete(Object response) {
if (response == null) {
Helper.showToast((int) R.string.cb);
return;
}
JSONObject jsonResponse = (JSONObject) response;
if (jsonResponse == null || jsonResponse.length() != 0) {
new UserInfo(activity, SNSLogin.mTencent.getQQToken()).getUserInfo(new
BaseUIListener(url, activity, jsonResponse, callback));
} else {
Helper.showToast((int) R.string.cb);
}
}
public void onError(UiError e) {
Helper.showToast((int) R.string.ca);
}
public void onCancel() {
Helper.showToast((int) R.string.c_);
}
});
}
示例2: 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"));
}*/
}
});
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: onComplete
import com.tencent.connect.UserInfo; //导入依赖的package包/类
public void onComplete(Object response) {
/*
到此已经获得OpenID以及其他你想获得的内容了
QQ登录成功了,我们还想获取一些QQ的基本信息,比如昵称,头像
sdk给我们提供了一个类UserInfo,这个类中封装了QQ用户的一些信息,我么可以通过这个类拿到这些信息
*/
QQToken qqToken = mTencent.getQQToken();
UserInfo info = new UserInfo(mContext, qqToken);
mSubscriber.onNext(info);
}
示例7: initView
import com.tencent.connect.UserInfo; //导入依赖的package包/类
@Override
public void initView() {
//QQ的初始化
mTencent = Tencent.createInstance("1105704769", this.getApplicationContext());
mInfo = new UserInfo(this, mTencent.getQQToken());
mReLogin = (RelativeLayout) findViewById(re_login);
mEtPhone = (EditText) findViewById(R.id.et_phone);
mEtPassword = (EditText) findViewById(R.id.et_password);
mIsPasswordMemory = (CheckBox) findViewById(R.id.is_password_memory);
boolean isSelect = PreferencesUtils.getBoolean(LoginActivity.this, "is_select");
mIsPasswordMemory.setChecked(isSelect);
mTvForgetPassword = (TextView) findViewById(R.id.tv_forget_password);
mRegisterAccount = (TextView) findViewById(R.id.register_account);
mApplicationConsultant = (TextView) findViewById(R.id.application_consultant);
mQqLogin = (ImageView) findViewById(R.id.qq_login);
mSinaLogin = (ImageView) findViewById(R.id.sina_login);
mWxLogin = (ImageView) findViewById(R.id.wx_login);
String username = PreferencesUtils.getString(this, "user");
String password = PreferencesUtils.getString(this, "pwd");
if (!TextUtils.isEmpty(username)) {
mEtPhone.setText(username);
}
if (!TextUtils.isEmpty(password)) {
mEtPassword.setText(password);
}
}
示例8: 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);
}
}
示例9: 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();
}
});
}
示例10: onCreate
import com.tencent.connect.UserInfo; //导入依赖的package包/类
/**
* This is called when the database is first created. Usually you should
* call createTable statements here to create the tables that will store
* your data.
*/
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
Log.i(DatabaseHelperT.class.getName(), "onCreate");
try {
TableUtils.createTable(connectionSource, UserInfo.class);
} catch (java.sql.SQLException e) {
Log.e(DatabaseHelperT.class.getName(), "Can't create database", e);
throw new RuntimeException(e);
}
}
示例11: onUpgrade
import com.tencent.connect.UserInfo; //导入依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher
* version number. This allows you to adjust the various data to match the
* new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion,
int newVersion) {
Log.i(DatabaseHelperT.class.getName(), "onUpgrade");
try {
TableUtils.dropTable(connectionSource, UserInfo.class, true);
onCreate(db, connectionSource);
} catch (java.sql.SQLException e) {
Log.e(DatabaseHelperT.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例12: 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: 获取失败");
}
}
示例13: e
import com.tencent.connect.UserInfo; //导入依赖的package包/类
private void e() {
this.k++;
new UserInfo(this, this.b).getUserInfo(this.w);
}
示例14: getUserInfo
import com.tencent.connect.UserInfo; //导入依赖的package包/类
public void getUserInfo(final UMDataListener listener) {
listener.onStart();
if (this.mTencent == null) {
listener.onComplete(StatusCode.ST_CODE_SDK_NO_OAUTH, null);
} else {
new UserInfo(this.mContext, this.mTencent.getQQToken()).getUserInfo(new IUiListener() {
public void onCancel() {
listener.onComplete(StatusCode.ST_CODE_ERROR_CANCEL, null);
}
public void onComplete(Object arg) {
if (arg == null) {
listener.onComplete(StatusCode.ST_CODE_ERROR, null);
return;
}
try {
JSONObject jsonObject = new JSONObject(arg.toString());
Map<String, Object> infos = new HashMap();
infos.put("screen_name", jsonObject.optString(UserTimelineActivity
.NICK_NAME));
infos.put(SocializeProtocolConstants.PROTOCOL_KEY_GENDER, jsonObject
.optString(SocializeProtocolConstants.PROTOCOL_KEY_GENDER));
infos.put(SocializeProtocolConstants.PROTOCOL_KEY_FRIENDS_ICON,
jsonObject.optString("figureurl_qq_2"));
infos.put("is_yellow_year_vip", jsonObject.optString("is_yellow_year_vip"));
infos.put("yellow_vip_level", jsonObject.optString("yellow_vip_level"));
infos.put("msg", jsonObject.optString("msg"));
infos.put("city", jsonObject.optString("city"));
infos.put("vip", jsonObject.optString("vip"));
infos.put("level", jsonObject.optString("level"));
infos.put("province", jsonObject.optString("province"));
infos.put("is_yellow_vip", jsonObject.optString("is_yellow_vip"));
infos.put("openid", OauthHelper.getUsid(UMQQSsoHandler.this.mContext,
SHARE_MEDIA.QQ));
listener.onComplete(200, infos);
} catch (JSONException e) {
listener.onComplete(StatusCode.ST_CODE_ERROR, null);
}
}
public void onError(UiError arg0) {
listener.onComplete(StatusCode.ST_CODE_ERROR, null);
}
});
}
}
示例15: getmInfo
import com.tencent.connect.UserInfo; //导入依赖的package包/类
public static UserInfo getmInfo() {
return mInfo;
}