How to implement third-party QQ login in Android
This article mainly introduces the relevant knowledge of "how to achieve third-party QQ login in Android". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to achieve third-party QQ login in Android" can help you solve the problem.
QQ of third party login
Code area
Public class MainActivity extends AppCompatActivity {private Button btn; private TextView tv; private ImageView image; @ Override protected void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); btn = (Button) findViewById (R.id.btn); tv = (TextView) findViewById (R.id.tv); image = (ImageView) findViewById (R.id.image) Btn.setOnClickListener (new View.OnClickListener () {@ Override public void onClick (View view) {UMShareAPI.get (MainActivity.this) .getPlatformInfo (MainActivity.this, SHARE_MEDIA.QQ, umAuthListener);}}) } private UMAuthListener umAuthListener = new UMAuthListener () {@ Override public void onStart (SHARE_MEDIA platform) {/ / callback} @ Override public void onComplete (SHARE_MEDIA platform, int action, Map data) {Toast.makeText (getApplicationContext (), "Authorize succeed", Toast.LENGTH_SHORT). Show (); String name = data.get ("name"); String gender = data.get ("gender"); String photoUrl = data.get ("iconurl") Tv.setText (name + "" + gender); ImageLoader.getInstance (). DisplayImage (photoUrl,image);} @ Override public void onError (SHARE_MEDIA platform, int action, Throwable t) {Toast.makeText (getApplicationContext (), "Authorize fail", Toast.LENGTH_SHORT). Show ();} @ Override public void onCancel (SHARE_MEDIA platform, int action) {Toast.makeText (getApplicationContext (), "Authorize cancel", Toast.LENGTH_SHORT). Show ();}} @ Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {super.onActivityResult (requestCode, resultCode, data); UMShareAPI.get (this) .onActivityResult (requestCode, resultCode, data) }} buildTypes {release {minifyEnabled false signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile ('proguard-android.txt'),' proguard-rules.pro'} debug {minifyEnabled false signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile ('proguard-android.txt'),' proguard-rules.pro'}} signingConfigs {debug {storeFile file ('debug.keystore') storePassword "android" keyAlias "androiddebugkey" keyPassword "android"}}
With a photo.
This is the end of the introduction on "how to implement third-party QQ login in Android". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.