Android umengsharesdk third-party login

Source: Internet
Author: User

android umengsharesdk third-party login-no nonsense today, integrated platform third-party login. There are SHARESDK and ument two kinds of integrated platform on the market, Sharesdk IPA and service is better, if own research institute is very convenient. Other features not much wrong, this cheat article will outline Ument's third-party logins.

  1. First you get the Friends league up to create accounts and apps this is the link http://www.umeng.com/, get your app's Appkey configured in manifest.
  2. Download the Ument Integration SDK, copy res and blis to your project or add dependent libraries and configure Mainfest.
  3. Define the Umsocialservice in your main path. Suggested in the application
    public static final Umsocialservice Mcontroller = umservicefactory. Getumsocialservice ("Com.umeng.share", Requesttype.social);
  4. Adding a listener to initialization init
  5. Mcontroller.getplatforminfo (this, Share_media. SINA, New Umdatalistener () {@Override public void OnStart () {}

    @Override public void OnComplete (int status, map<string, object> info) {//The licensing information for the related platform is encapsulated in the form k-v in info if (status = = $ && Info! = null) {StringBuilder SB = new StringBuilder (); set<string> keys = Info.keyset (); token = (String) info.get ("Access_token"); for (String Kstr:keys) {sb.append (kstr + "=" + Info.get (KSTR). toString () + "\ r \ n");} Toast.maketext (mainactivity.this, token, 0). Show (); Generalutil.debugginglog (TAG, sb.tostring ()); } else Generalutil.debugginglog (TAG, "failed"); } });

    }`

  6. Information about third-party logins exists in the form of key-value pairs in the post-callback info. The key collection can be obtained by Setkey.

  7. You can then save the most important tokens and add mcontroller.dooauthverify (this, SHARE MEDIA) to your authorized listener. SINA, New Umauthlistener () {@Override public void OnStart (SHAREMEDIA arg0) {}

    @Override public void OnError (Socializeexception arg0, Share_media arg1) {} @Override public void OnComplete (Bundle arg0, Share_media arg1) {toast.maketext (mainactivity.this, token, 0). Show (); @Override public void OnCancel (Share_media arg0 ) { } });`
  8. The OnComplete method is a successful callback, others can refer to the API.

    • ument Third-party login explained so far, Ument API is not very detailed, in the search engine and did not find a more direct example of good. If the reference dome may take some detours. I hope this simple and direct tutorial can give a little inspiration to the younger generation.

This isn't nonsense, integration platform of third party logging. The market integration platform with SHARESDK and ument, SHARESDK IPA and service better, if your, I'll be ver Y convenient. The other function isn't wrong, this article would provide an overview of ument third logon.

  1. First get the alliance to create the account and the application of the link [http://www.umeng.com/] (http://w ww.umeng.com/), get your application in the manifest configuration Appkey.
  2. Download ument integrated SDK, copy the res and BLIS to your project or add library dependencies and configuration of main Fest.
  3. In the Lord your process definition Umsocialservice. Suggestions in applicationpublic static final Umsocialservice Mcontroller = umservicefactory. Getumsocialservice (& quot Com.umeng.share&quot, requesttype.social;);
  4. In the initialization init add monitor
  5. Mcontroller.getplatforminfo (This, SHAREMEDIA. SINA, New Umdatalistener () {@Override public (void OnStart) {} @Override public void oncomplete (int status, MAP<STR ing, object> Info) {//relevant platform authorization information in the form of K-V package in info If (status = = & & Info! = null) {StringBuilder SB = new (StringBuilder); Set keys = Info.keyset (); Token = (String) info.get ("Accesstoken"); for (String Kstr:keys) {sb.append (kstr + "=" Info.get (KSTR) + (. ToString) + "\ r \ n"); } toast.maketext (Mainactivity.this, token,. Show (0)); Generalutil.debugginglog (TAG, sb.tostring) (); } else Generalutil.debugginglog (TAG, "failure"); } }); }`
  6. Third party login information would exist in the form of Key/value in the callback after info. Through the Setkey can get the key set.
  7. Then you can save the most important tokens, and add mcontroller.dooauthverify in authorization monitoring your in (this, SHAREMEDIA. SINA, New Umauthlistener () {@Override public void OnStart (SHAREMEDIA arg0) {} @Override public void OnError (SOCI Alizeexception arg0, Share_media arg1) {} @Override public void OnComplete (Bundle arg0, SHAREMEDIA arg1) {Toast.mak EText (Mainactivity.this, token,. Show (0)); } @Override public void OnCancel (SHAREMEDIA arg0) {} ');}
  8. OnComplete is a success callback and the other can refer to API.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.