100044 error reported during QQ Internet login and unofficial genuine applications, 100044 error reported
When a third-party QQ log on, an unofficial genuine application is displayed, and error 100044 is reported;
Pit 1: we need to set the package name and signature after successfully registering on QQ Internet. The signature is generated using an official tool. Note: The signature here needs to be generated by the APK after the signature is packaged. We did not pass the signature during the test. Therefore, we generally need to add at least two signatures here: one developed and tested APP directly generates the signature using the official tool, and the other used to package the signature of our APP through our own signature file;
@ Override public void onClick (View view) {switch (view. getId () {case R. id. iv_login_qq: // click qq to log on to onClickLogin (); break ;}}
OnClickLogin () method:
Private void onClickLogin () {if (! MTencent. isSessionValid () {mTencent. login (this, "all", loginListener); isServerSideLogin = false;} login in else {if (isServerSideLogin) {// Server-Side mode, exit first, then log on to mTencent through SSO. logout (this); mTencent. login (this, "all", loginListener); isServerSideLogin = false; return;} mTencent. logout (this );}
LoginListener interface:
IUiListener loginListener = new BaseUiListener () {@ Override protected void doComplete (JSONObject values) {Timestamp = SystemClock. elapsedRealtime () + ""; Log. d (TAG, "AuthorSwitch_SDK:" + SystemClock. elapsedRealtime (); initOpenidAndToken (values); // obtain logon return information such as token updateUserInfo (); // asynchronously update and save user information }};
InitOpenidAndToken () method:
public void initOpenidAndToken(JSONObject jsonObject) { try { token = jsonObject.getString(Constants.PARAM_ACCESS_TOKEN); expires = jsonObject.getString(Constants.PARAM_EXPIRES_IN); openId_qq = jsonObject.getString(Constants.PARAM_OPEN_ID); Log.d(TAG, "initOpenidAndToken: token:" + token); Log.d(TAG, "initOpenidAndToken: expires:" + expires); Log.d(TAG, "initOpenidAndToken: openId:" + openId_qq); if (!TextUtils.isEmpty(token) && !TextUtils.isEmpty(expires) && !TextUtils.isEmpty(openId_qq)) { mTencent.setAccessToken(token, expires); mTencent.setOpenId(openId_qq); } } catch (Exception e) { } }
UpdateUserInfo () method:
private void updateUserInfo() { if (mTencent != null && mTencent.isSessionValid()) { IUiListener listener = new IUiListener() { @Override public void onError(UiError e) { Log.d(TAG, "onError: "); } @Override public void onComplete(final Object response) { new Thread() { @Override public void run() { JSONObject json = (JSONObject) response;if (json.has("figureurl")) { try { String userName = json.getString("nickname"); Log.d(TAG, "run: " + userName); String userIcon = json.getString("figureurl_qq_2"); Log.d(TAG, "run: " + userIcon); String gender = json.getString("gender"); String province = json.getString("province"); String city = json.getString("city"); SharedPreferences user_login = LoginActivity.this.getSharedPreferences("user_login", MODE_PRIVATE); SharedPreferences.Editor edit = user_login.edit(); edit.putString("user_name", userName); edit.putString("user_pic", userIcon); edit.putString("gender", gender); edit.putString("province", province); edit.putString("city", city); edit.putString("openid_qq", openId_qq); edit.commit(); mHandler.sendEmptyMessage(POST_LOGIN_INIFO); } catch (JSONException e) { } } } }.start(); } @Override public void onCancel() { Log.d(TAG, "onCancel: "); } }; mInfo = new UserInfo(this, mTencent.getQQToken()); mInfo.getUserInfo(listener); } else {// mUserInfo.setText("");// mUserInfo.setVisibility(android.view.View.GONE);// mUserLogo.setVisibility(android.view.View.GONE); } }
The onActivityResult () method must be rewritten.
@ Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {Log. d (TAG, "--> onActivityResult: requestCode =" + requestCode + "resultCode =" + resultCode); if (requestCode = Constants. REQUEST_LOGIN | requestCode = Constants. REQUEST_APPBAR) {Tencent. onActivityResultData (requestCode, resultCode, data, loginListener); AppShared. setUserLogin (this, true); ToastUtils. toast ("Login successful");} super. onActivityResult (requestCode, resultCode, data );}
One suggestion: We recommend that you save the user profile picture link and then directly save bitmap. In onResume, you can download the Bitmap image, even if you have set a clear cache, the user's profile picture will be retrieved again when it is returned to the page.