本文整理汇总了Java中com.umeng.socialize.weixin.controller.UMWXHandler类的典型用法代码示例。如果您正苦于以下问题:Java UMWXHandler类的具体用法?Java UMWXHandler怎么用?Java UMWXHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UMWXHandler类属于com.umeng.socialize.weixin.controller包,在下文中一共展示了UMWXHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
private void init() {
mController = UMServiceFactory.getUMSocialService("com.umeng.share");
if (mListener != null) {
mController.unregisterListener(mListener);
}
mListener = new MSnsPostListener();
mController.registerListener(mListener);
new UMWXHandler(mActivity, WX_APPID, WX_APPKEY).addToSocialSDK();
new UMWXHandler(mActivity, WX_APPID, WX_APPKEY).setToCircle(true).addToSocialSDK();
new QZoneSsoHandler(mActivity, "100530867", "d32ea174315e9c42bfbd481ac3b3fef6")
.addToSocialSDK();
new UMQQSsoHandler(mActivity, "100530867", "d32ea174315e9c42bfbd481ac3b3fef6")
.addToSocialSDK();
mController.getConfig().removePlatform(new SHARE_MEDIA[]{SHARE_MEDIA.TENCENT, SHARE_MEDIA
.RENREN, SHARE_MEDIA.DOUBAN});
mController.getConfig().setPlatformOrder(new SHARE_MEDIA[]{SHARE_MEDIA.SINA, SHARE_MEDIA
.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.QZONE, SHARE_MEDIA.QQ});
}
示例2: onClick
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
public void onClick(SHARE_MEDIA args) {
switch (AnonymousClass4.$SwitchMap$com$umeng$socialize$bean$SHARE_MEDIA[args.ordinal()]) {
case 1:
this.mController.getConfig().setSsoHandler(new SinaSsoHandler());
doSNSLogin(SHARE_MEDIA.SINA);
return;
case 2:
this.mController.getConfig().setSsoHandler(new QZoneSsoHandler(this.mActivity,
"100530867", "d32ea174315e9c42bfbd481ac3b3fef6"));
doSNSLogin(SHARE_MEDIA.QZONE);
return;
case 3:
UMWXHandler wxHandler = new UMWXHandler(this.mActivity, ShareHelper.WX_APPID,
ShareHelper.WX_APPKEY);
wxHandler.setRefreshTokenAvailable(false);
this.mController.getConfig().setSsoHandler(wxHandler);
doSNSLogin(SHARE_MEDIA.WEIXIN);
return;
default:
return;
}
}
示例3: onCreate
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
//handler init
handler=new MyHandler(this);
mBtnWeixin = (Button) findViewById(R.id.btn_weixin);
mTvAgreement = (TextView) findViewById(R.id.tv_user_agreement);
mBtnWeixin.setOnClickListener(this);
//agreement
SpannableString agreement = new SpannableString("使用即表示同意用户协议");
agreement.setSpan(new NoLineClickSpan(), 7, agreement.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvAgreement.setText(agreement);
mTvAgreement.setMovementMethod(LinkMovementMethod.getInstance());
//set up umeng
mLoginController.getConfig().setSsoHandler(new SinaSsoHandler());
String appId = AppContext.getInstance().getMetaData("WEIXIN_ID");
String appSecret = AppContext.getInstance().getMetaData("WEIXIN_SECRET");
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(SignInActivity.this, appId, appSecret);
wxHandler.addToSocialSDK();
}
示例4: useSocialLogin
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* 自定义自己的登录系统
*/
protected void useSocialLogin() {
// 用户自定义的登录
UMAuthService mLogin = UMLoginServiceFactory.getLoginService("umeng_login_impl");
String appId = "1104606393";
String appKey = "X4BAsJAVKtkDQ1zQ";
// SSO 设置
// mLogin.getConfig().setSsoHandler(new SinaSsoHandler());
new UMQQSsoHandler(this, appId, appKey).addToSocialSDK();
String wxappId = "wx96110a1e3af63a39";
String wxappSecret = "c60e3d3ff109a5d17013df272df99199";
new UMWXHandler(getApplicationContext(), wxappId,
wxappSecret).addToSocialSDK();
// 将登录实现注入到sdk中,key为umeng_login
LoginSDKManager.getInstance().addAndUse(mLogin);
}
示例5: initWXHandler
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
protected void initWXHandler() {
SocializeConfig socializeConfig = SocializeConfig.getSocializeConfig();
int requestCode = 10086;
if (SocializeConfig.getSelectedPlatfrom() == SHARE_MEDIA.WEIXIN_CIRCLE) {
requestCode = HandlerRequestCode.WX_CIRCLE_REQUEST_CODE;
}
UMSsoHandler ssoHandler = socializeConfig.getSsoHandler(requestCode);
if (ssoHandler instanceof UMWXHandler) {
this.mWxHandler = (UMWXHandler) ssoHandler;
}
}
示例6: initSocial
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
protected void initSocial(){
mShareController.getConfig().removePlatform(SHARE_MEDIA.RENREN,
SHARE_MEDIA.DOUBAN, SHARE_MEDIA.QZONE, SHARE_MEDIA.SINA,
SHARE_MEDIA.TENCENT);
//设置新浪SSO handler
mShareController.getConfig().setSsoHandler(new SinaSsoHandler());
String appId = AppContext.getInstance().getMetaData("WEIXIN_ID");
String appSecret = AppContext.getInstance().getMetaData("WEIXIN_SECRET");
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(this, appId, appSecret);
wxHandler.addToSocialSDK();
// 设置微信朋友分享内容
WeiXinShareContent weiXinShareContent = new WeiXinShareContent();
weiXinShareContent.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
weiXinShareContent.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
weiXinShareContent.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
weiXinShareContent.setTargetUrl(BaseClient.URL_USER_ABOUT);
mShareController.setShareMedia(weiXinShareContent);
// 添加微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(this, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
// 设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
circleMedia.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
circleMedia.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
circleMedia.setTargetUrl(BaseClient.URL_USER_ABOUT);
// 设置分享内容
mShareController.setShareMedia(circleMedia);
}
示例7: addWXPlatform
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* @功能描述 : 添加微信平台分享
* @return
*/
private static void addWXPlatform(Context context) {
// 注意:在微信授权的时候,必须传递appSecret
// wx967daebe835fbeac是你在微信开发平台注册应用的AppID, 这里需要替换成你注册的AppID
String appId = AppConstants.WEXIN_APPID;
String appSecret = AppConstants.WEXIN_APPSECRET;
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(context, appId, appSecret);
wxHandler.addToSocialSDK();
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(context, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
}
示例8: initPlatforms
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* 初始化分享相关的平台
*
* @param activity
*/
private void initPlatforms(Activity activity) {
// 添加QQ
UMQQSsoHandler qqHandler = new UMQQSsoHandler(activity, "1104606393",
"X4BAsJAVKtkDQ1zQ");
qqHandler.addToSocialSDK();
// 添加QZone平台
QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(activity, "1104606393",
"X4BAsJAVKtkDQ1zQ");
qZoneSsoHandler.addToSocialSDK();
// 添加微信平台
UMWXHandler wechatHandler = new UMWXHandler(activity, "wx96110a1e3af63a39",
"c60e3d3ff109a5d17013df272df99199");
wechatHandler.addToSocialSDK();
// 添加微信朋友圈平台
UMWXHandler circleHandler = new UMWXHandler(activity, "wx96110a1e3af63a39",
"c60e3d3ff109a5d17013df272df99199");
circleHandler.setToCircle(true);
circleHandler.addToSocialSDK();
UMShareServiceFactory.getSocialService().getConfig()
.setPlatforms(SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.WEIXIN,
SHARE_MEDIA.QZONE, SHARE_MEDIA.QQ, SHARE_MEDIA.SINA);
UMShareServiceFactory.getSocialService().getConfig()
.setPlatformOrder(SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.WEIXIN,
SHARE_MEDIA.QZONE, SHARE_MEDIA.QQ, SHARE_MEDIA.SINA);
}
示例9: addWXPlatform
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* @param context
* @return
* @功能描述 : 添加微信平台分享
*/
private void addWXPlatform(Context context) {
// 注意:在微信授权的时候,必须传递appSecret
// wx967daebe835fbeac是你在微信开发平台注册应用的AppID, 这里需要替换成你注册的AppID
String appId = "wxc2c816c4c29e7d4c";
String appSecret = "ad9667b7939804c1127cbd61db0640d7";
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(context, appId, appSecret);
wxHandler.addToSocialSDK();
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(context, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
}
示例10: addWXPlatform
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* @功能描述 : 添加微信平台分享
* @return
*/
private void addWXPlatform(Activity context) {
// 注意:在微信授权的时候,必须传递appSecret
// wx967daebe835fbeac是你在微信开发平台注册应用的AppID, 这里需要替换成你注册的AppID
String appId = "wx967daebe835fbeac";
String appSecret = "5bb696d9ccd75a38c8a0bfe0675559b3";
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(context, appId, appSecret);
wxHandler.addToSocialSDK();
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(context, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
}
示例11: completeUmeng
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
private void completeUmeng() {
//添加QQ平台
UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(getActivity(), "1104326437",
"Jj4RMmh7LOSdOeSU");
qqSsoHandler.addToSocialSDK();
//添加QQ空间平台
QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(getActivity(), "1104326437",
"Jj4RMmh7LOSdOeSU");
qZoneSsoHandler.addToSocialSDK();
//设置新浪SSO handler
controller.getConfig().setSsoHandler(new SinaSsoHandler());
//设置腾讯微博SSO handler
controller.getConfig().setSsoHandler(new TencentWBSsoHandler());
String appId = "wxd2033153d9e5d21c";
String appSecret = "9e07451fa60ee561bd688565aa5112cd";
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(getActivity(),appId,appSecret);
wxHandler.addToSocialSDK();
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(getActivity(),appId,appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
}
示例12: addWXPlatform
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
/**
* @功能描述 : 添加微信平台分享
* @return
*/
private void addWXPlatform() {
// 注意:在微信授权的时候,必须传递appSecret
// wx967daebe835fbeac是你在微信开发平台注册应用的AppID, 这里需要替换成你注册的AppID
String appId = "wx55e834ca0a0327a6";
String appSecret = "5bb696d9ccd75a38c8a0bfe0675559b3";
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(this, appId, appSecret);
wxHandler.addToSocialSDK();
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(this, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
}
示例13: shareToWeiChatCircle
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
private void shareToWeiChatCircle() {
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(getActivity(),
Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
// 设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(getShareContent());
// 设置朋友圈title
circleMedia.setTitle(getShareTitle());
circleMedia.setShareImage(new UMImage(getActivity(), R.drawable.ima_app_icon));
circleMedia.setTargetUrl(getShareUrl());
mController.setShareMedia(circleMedia);
mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN_CIRCLE,
new SnsPostListener() {
@Override
public void onStart() {
AppContext.showToastShort(R.string.tip_start_share);
}
@Override
public void onComplete(SHARE_MEDIA arg0, int arg1,
SocializeEntity arg2) {
AppContext.showToastShort(R.string.tip_share_done);
}
});
}
示例14: shareToWeiChat
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
private void shareToWeiChat() {
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(getActivity(),
Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
wxHandler.addToSocialSDK();
// 设置微信好友分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
// 设置分享文字
weixinContent.setShareContent(getShareContent());
// 设置title
weixinContent.setTitle(getShareTitle());
// 设置分享内容跳转URL
weixinContent.setTargetUrl(getShareUrl());
// 设置分享图片
weixinContent.setShareImage(new UMImage(getActivity(), R.drawable.ima_app_icon));
mController.setShareMedia(weixinContent);
mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN,
new SnsPostListener() {
@Override
public void onStart() {
AppContext.showToastShort(R.string.tip_start_share);
}
@Override
public void onComplete(SHARE_MEDIA arg0, int arg1,
SocializeEntity arg2) {
AppContext.showToastShort(R.string.tip_share_done);
}
});
}
示例15: shareToWeiChatCircle
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入依赖的package包/类
private void shareToWeiChatCircle() {
// 支持微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(getActivity(),
Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
// 设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(getShareContent());
// 设置朋友圈title
circleMedia.setTitle(getShareTitle());
// circleMedia.setShareImage(localImage);
circleMedia.setTargetUrl(getShareUrl());
mController.setShareMedia(circleMedia);
mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN_CIRCLE,
new SnsPostListener() {
@Override
public void onStart() {
AppContext.showToastShort(R.string.tip_start_share);
}
@Override
public void onComplete(SHARE_MEDIA arg0, int arg1,
SocializeEntity arg2) {
AppContext.showToastShort(R.string.tip_share_done);
}
});
}