日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android UmengShareSDK第三方登录

發布時間:2025/3/14 Android 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android UmengShareSDK第三方登录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Android UmengShareSDK 第三方登錄- 今天就不廢話了,集成平臺第三方登錄。市面上集成平臺有shareSDK 和 Ument兩種,shareSDK的ipa和服務好些,如果自己研究會很方便。其他功能錯不多,這騙文章將概述Ument的第三方登錄。

  • 首先你得到友盟上去創建帳戶和應用這是鏈接http://www.umeng.com/,獲取你應用的Appkey在manifest中配置。
  • 下載Ument集成SDK,復制res和blis到你工程中或者添加依賴庫并配置mainfest。
  • 在你的主程中定義UMSocialService。建議在application中
    public static final UMSocialService mController = UMServiceFactory .getUMSocialService("com.umeng.share", RequestType.SOCIAL);
  • 在初始化init中添加監聽
  • mController.getPlatformInfo(this, SHARE_MEDIA.SINA, new UMDataListener() { @Override public void onStart() { }

    @Override public void onComplete(int status, Map<String, Object> info) { // 相關平臺的授權信息都以K-V的形式封裝在info中 if (status == 200 && 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, "失敗"); } });

    }`

  • 第三方登錄的信息會在回調后的info中以鍵值對的形式存在。通過setkey可以拿到鍵集合。

  • 接下來就可以保存最重要的token了,完事在你的授權監聽中添加 mController.doOauthVerify(this, SHAREMEDIA.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) { } });`
  • onComplete方法就是成功回調,其他可以參考api.

    • Ument第三方登錄講解到此為止,ument的api并沒有很詳細,在搜索引擎并未能發現比較直接好的例子。如果參照dome可能會走些彎路。希望這個簡單直接的教程能夠給后輩們一些個啟發。

    this is not nonsense, integration platform of third party logging. The market integration platform with shareSDK and Ument two, shareSDK IPA and service better, if your research will be very convenient. The other function is not wrong, this article will provide an overview of Ument third logon.

  • first you get the alliance to create the account and the application of this is the link [http://www.umeng.com/] (http://www.umeng.com/), get your application in the manifest configuration Appkey.
  • download Ument integrated SDK, copy the res and BLIS to your project or add library dependencies and configuration of mainfest.
  • in the LORD your process definition UMSocialService. Suggestions in applicationpublic static final UMSocialService mController = UMServiceFactory .getUMSocialService (&quot; com.umeng.share&quot, RequestType.SOCIAL;);
  • in the initialization init add monitor
  • mController.getPlatformInfo (this, SHAREMEDIA.SINA, New UMDataListener () { @Override Public (void onStart) { } @Override Public void onComplete (int status, Map<String, Object> info) { / / relevant platform authorization information in the form of K-V package in info If (status = = 200 & & 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"); } }); }`
  • third party login information will exist in the form of key / value in the callback after info. Through the setkey can get the key set.
  • then you can save the most important token, and add mController.doOauthVerify in authorization monitoring your in ( this, SHAREMEDIA.SINA, New UMAuthListener () { @Override Public void onStart (SHAREMEDIA arg0) { } @Override Public void onError (SocializeException arg0, SHARE_MEDIA arg1) { } @Override Public void onComplete (Bundle arg0, SHAREMEDIA arg1) { Toast.makeText (MainActivity.this, token,.Show (0)); } @Override Public void onCancel (SHAREMEDIA arg0) { } ');}
  • onComplete is a success callback, the other can refer to api.
  • 轉載于:https://www.cnblogs.com/qiaoxu/p/3867520.html

    總結

    以上是生活随笔為你收集整理的Android UmengShareSDK第三方登录的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。