Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement third-party QQ login in Android

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report