本文整理汇总了Java中com.sina.weibo.sdk.auth.AuthInfo类的典型用法代码示例。如果您正苦于以下问题:Java AuthInfo类的具体用法?Java AuthInfo怎么用?Java AuthInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthInfo类属于com.sina.weibo.sdk.auth包,在下文中一共展示了AuthInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sinaLoginClick
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void sinaLoginClick() {
LetvLogApiTool.getInstance().saveExceptionInfo("sina登录开始 Current Time :" + StringUtils.getTimeStamp());
if (NetworkUtils.isNetworkAvailable()) {
LogInfo.LogStatistics("新浪微博注册");
String pageId = this.mIsLoginPage ? PageIdConstant.loginPage : PageIdConstant.registerPage;
StatisticsUtils.statisticsActionInfo(this.mActivity, pageId, "0", this.mIsLoginPage ? "c72" : "c82", null, 2, "ref=" + pageId + "_072_2");
if (SinaWeiboUtils.isWeiboAppSupportAPI(this.mActivity, "3830215581", false)) {
this.mWeiboAuth = new AuthInfo(this.mActivity, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write");
this.mSsoHandler = new SsoHandler(this.mActivity, this.mWeiboAuth);
this.mSsoHandler.authorize(new AuthListener(this));
return;
}
LetvOpenIDOAuthLoginActivity.launch(this.mActivity, ShareUtils.getSinaLoginUrl(), getResources().getString(2131100352));
return;
}
ToastUtils.showToast(2131101012);
}
示例2: shareToWeibo
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public static void shareToWeibo(String transaction, Activity activity, String title, String summary, Bitmap img) {
ImageObject imageObject = new ImageObject();
imageObject.imageData = bmpToByteArray(img);
TextObject textObject = new TextObject();
textObject.text = title + "\n" + summary + Constants.SUMMARY;
WeiboMultiMessage message = new WeiboMultiMessage();
message.textObject = textObject;
message.imageObject = imageObject;
SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
request.transaction = transaction;
request.multiMessage = message;
AuthInfo authInfo = new AuthInfo(activity, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE);
Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(APP_CONTEXT);
String token = "";
if (accessToken != null) {
token = accessToken.getToken();
}
IWeiboShareAPI api = getWbApi();
api.sendRequest(activity, request, authInfo, token, weiboAuthListener);
}
示例3: weiboLogin
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
/**
* 微博登陆
*/
private void weiboLogin(){
mAuthInfo = new AuthInfo(this, Constants.WEIBO_APP_KEY, Constants.WEIBO_REDIRECT_URL, Constants.WEIBO_SCOPE);
mSsoHandler = new SsoHandler(this, mAuthInfo);
// Web授权
//mSsoHandler.authorizeWeb(new LoginWeiboAuthListener());
// SSO授权
//mSsoHandler.authorizeClientSso(new LoginWeiboAuthListener());
// All in one
// 此种授权方式会根据手机是否安装微博客户端来决定使用sso授权还是网页授权,
// 如果安装有微博客户端 则调用微博客户端授权,否则调用Web页面方式授权
try {
mSsoHandler.authorize(new LoginWeiboAuthListener());
}catch (Exception e){
Log.e(TAG, "weibo login exception: " + e.getMessage());
}
}
示例4: onCreate
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
if(intent == null){
finish();
return;
}
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
inflater = LayoutInflater.from(this);
mTencent = Tencent.createInstance(Globe.QQ_APP_ID, this);
mAuthInfo = new AuthInfo(this, Globe.SINA_APP_KEY, Globe.SINA_REDIRECT_URL, null);
mSsoHandler = new SsoHandler(this, mAuthInfo);
mIWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, Globe.SINA_APP_KEY);
mIWeiboShareAPI.registerApp();
}
示例5: init
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
protected void init() {
// 设置Logo 1/4 处
tvLoginTitle = (TextView) findViewById(R.id.tv_login_title);
tvLoginTitle.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) tvLoginTitle.getLayoutParams();
layoutParams.setMargins(0, Math.round(App.SCREEN_HEIGHT / 4f), 0, 0);
tvLoginTitle.setLayoutParams(layoutParams);
}
});
// 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
mAuthInfo = new AuthInfo(this, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
mSsoHandler = new SsoHandler(LoginActivity.this, mAuthInfo);
// SSO 授权, 仅Web
findViewById(R.id.btn_login).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mSsoHandler.authorizeWeb(new AuthListener());
}
});
}
示例6: init
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public void init(JSONArray json, CallbackContext cbContext) {
appKey = getData(json, "appKey");
String redirectURI = getData(json, "redirectURI");
String scope = getData(json, "scope");
if (scope == null) {
scope = "all";
}
try {
mAuthInfo = new AuthInfo(this.cordova.getActivity()
.getApplicationContext(), appKey, redirectURI, scope);
// mSsoHandler = new SsoHandler(WBAuthActivity.this, mAuthInfo);
// mWeiboAuth = new
// WeiboAuth(this.cordova.getActivity().getApplicationContext(),
// appKey, redirectURI, scope);
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
callbackContext.sendPluginResult(pluginResult);
} catch (Exception e) {
e.printStackTrace();
callbackContext.error(getErrorObject(e.getMessage()));
}
}
示例7: WeiboLoginInstance
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public WeiboLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) {
super(activity, listener, fetchUserInfo);
AuthInfo authInfo = new AuthInfo(activity, ShareManager.CONFIG.getWeiboId(),
ShareManager.CONFIG.getWeiboRedirectUrl(), ShareManager.CONFIG.getWeiboScope());
mSsoHandler = new SsoHandler(activity, authInfo);
mLoginListener = listener;
}
示例8: allInOneShare
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void allInOneShare(final Context context, SendMultiMessageToWeiboRequest request) {
AuthInfo authInfo = new AuthInfo(context, mSinaAppKey, REDIRECT_URL, SCOPE);
Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
String token = "";
if (accessToken != null) {
token = accessToken.getToken();
}
mSinaAPI.sendRequest((Activity) context, request, authInfo, token, new WeiboAuthListener() {
@Override
public void onWeiboException(WeiboException arg0) {
Toast.makeText(context, context.getString(
R.string.share_failed), Toast.LENGTH_SHORT).show();
}
@Override
public void onComplete(Bundle bundle) {
Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle);
AccessTokenKeeper.writeAccessToken(context, newToken);
Toast.makeText(context, context.getString(
R.string.share_success), Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast.makeText(context, context.getString(
R.string.share_cancel), Toast.LENGTH_SHORT).show();
}
});
}
示例9: login
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
public void login(PlatformActionListener platformActionListener) {
mPlatformActionListener = platformActionListener;
AccessTokenKeeper.clear(mContext);
mAuthInfo = new AuthInfo(mContext, mSinaAppKey, mRedirectUrl, SCOPE);
mSsoHandler = new SsoHandler((Activity) mContext, mAuthInfo);
mSsoHandler.authorize(new AuthListener());
}
示例10: onCreate
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.inject(this);
mAuthInfo = new AuthInfo(this, Constant.APP_KEY, Constant.REDIRECT_URL, Constant.SCOPE);
mLoginBtnDefault.setWeiboAuthInfo(mAuthInfo, mLoginListener); // 为按钮设置授权认证信息
}
示例11: shareToWeibo
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void shareToWeibo() {
mAccessToken = AccessTokenKeeper.readAccessToken(mContext);
if (mAccessToken != null) {
StatusesAPI statusAPI = new StatusesAPI(mContext, Constants.WEIBO_APPKEY, mAccessToken);
statusAPI.update(shareText + mContext.getResources().getString(R.string.shareDescription) + shareLink, "0.0", "0.0", weiboListener);
//statusAPI.uploadUrlText("分享一个音乐播放器,http://www.lingjutech.com", "http://tp3.sinaimg.cn/1706684510/50/22818070132/1", "", "0.0", "0.0", weiboListener);
} else {
AccessTokenKeeper.clear(mContext);
Log.i(TAG, "Context=" + mContext);
AuthInfo authInfo = new AuthInfo(mContext, Constants.WEIBO_APPKEY, Constants.REDIRECT_URL, Constants.SCOPE);
// WeiboAuth weiboAuth = new WeiboAuth(mContext, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
mSsoHandler = new SsoHandler((Activity) mContext, authInfo);
mSsoHandler.authorize(new AuthListener());
}
}
示例12: onClick
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.signin_btn) { // sign in
AuthInfo authInfo = new AuthInfo(this, WeiboData.APP_KEY, WeiboData.REDIRECT_URL, WeiboData.SCOPE);
ssoHandler = new SsoHandler(this, authInfo);
ssoHandler.authorize(this);
} else if (v.getId() == R.id.github_btn) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sherlockchou86"));
startActivity(browserIntent);
}
}
示例13: shareTo
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private static void shareTo(final Context context, final String appKey, final String redirectUrl, final String scop, final String title, final String desc,
final String imageUrl, final String shareUrl, final WeiboAuthListener listener) {
new Thread(new Runnable() {
@Override
public void run() {
WeiboMultiMessage msg = new WeiboMultiMessage();
TextObject text = new TextObject();
text.text = desc;
msg.textObject = text;
WebpageObject web = new WebpageObject();
web.description = desc;
byte[] thumb = SocialUtils.getHtmlByteArray(imageUrl);
if (null != thumb)
web.thumbData = SocialUtils.compressBitmap(thumb, 32);
else
web.thumbData = SocialUtils.compressBitmap(SocialUtils.getDefaultShareImage(context), 32);
web.actionUrl = shareUrl;
web.identify = imageUrl;
web.title = title;
msg.mediaObject = web;
SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
request.transaction = String.valueOf(System.currentTimeMillis());
request.multiMessage = msg;
AuthInfo authInfo = new AuthInfo(context, appKey, redirectUrl, scop);
Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
String token = "";
if (accessToken != null) {
token = accessToken.getToken();
}
getInstance(context, appKey).sendRequest((Activity) context, request, authInfo, token, listener);
}
}).start();
}
示例14: SsoHandler
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public SsoHandler(Activity activity, AuthInfo weiboAuthInfo) {
this.mAuthActivity = activity;
this.mAuthInfo = weiboAuthInfo;
this.mWebAuthHandler = new WebAuthHandler(activity, weiboAuthInfo);
this.mWeiboInfo = WeiboAppManager.getInstance(activity).getWeiboInfo();
AidTask.getInstance(this.mAuthActivity).aidTaskInit(weiboAuthInfo.getAppKey());
}
示例15: startAuth
import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public static void startAuth(Context context, String url, AuthInfo authInfo, WeiboAuthListener listener) {
AuthRequestParam reqParam = new AuthRequestParam(context);
reqParam.setLauncher(BrowserLauncher.AUTH);
reqParam.setUrl(url);
reqParam.setAuthInfo(authInfo);
reqParam.setAuthListener(listener);
Intent intent = new Intent(context, WeiboSdkBrowser.class);
intent.putExtras(reqParam.createRequestParamBundle());
context.startActivity(intent);
}