在你的主程中定義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() { }
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 (" com.umeng.share", 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.