本文整理汇总了Java中com.umeng.socialize.weixin.controller.UMWXHandler.addToSocialSDK方法的典型用法代码示例。如果您正苦于以下问题:Java UMWXHandler.addToSocialSDK方法的具体用法?Java UMWXHandler.addToSocialSDK怎么用?Java UMWXHandler.addToSocialSDK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.umeng.socialize.weixin.controller.UMWXHandler
的用法示例。
在下文中一共展示了UMWXHandler.addToSocialSDK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: 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();
}
示例4: 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);
}
示例5: 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();
}
示例6: 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();
}
示例7: 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();
}
示例8: 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();
}
示例9: 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);
}
});
}
示例10: 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);
}
});
}
示例11: 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);
}
});
}
示例12: 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(localImage);
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);
}
});
}
示例13: onCreate
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 设置分享内容
mController.setShareContent("友盟社会化组件(SDK)让移动应用快速整合社交分享功能,http://www.umeng.com/social");
// 设置分享图片, 参数2为图片的url地址
mController.setShareMedia(new UMImage(this, "http://www.umeng.com/images/pic/banner_module_social.png"));
String appId = "wx967daebe835fbeac";
String appSecret = "5fa9e68ca3970e87a1f83e563c8dcbce";
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(this, appId, appSecret);
wxHandler.addToSocialSDK();
// 添加微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(this, appId, appSecret);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
//qq
//参数1为当前Activity,参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY.
UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(this, "100424468",
"c7394704798a158208a74ab60104f0ba");
qqSsoHandler.addToSocialSDK();
//QQ空间
//参数1为当前Activity,参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY.
QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(this, "100424468",
"c7394704798a158208a74ab60104f0ba");
qZoneSsoHandler.addToSocialSDK();
//设置新浪SSO handler
mController.getConfig().setSsoHandler(new SinaSsoHandler());
mController.getConfig().removePlatform(SHARE_MEDIA.RENREN, SHARE_MEDIA.DOUBAN);
Button button = (Button) findViewById(R.id.bt);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mController.openShare(MainActivity.this, false);
}
});
}
示例14: onShareItemSelected
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入方法依赖的package包/类
public void onShareItemSelected() {
final UMSocialService socialService = UMServiceFactory.getUMSocialService("com.umeng.share");
// Remove Tencent Weibo and QZone from share panel.
socialService.getConfig().removePlatform(SHARE_MEDIA.TENCENT);
socialService.getConfig().removePlatform(SHARE_MEDIA.QZONE);
String webLink = this.topicInfo.getLinks().getWebURL();
String shareContent = this.topicInfo.getTitle() + " " + webLink;
String title = getString(R.string.share_topic, this.topicInfo.getUser().getData().getName());
socialService.setShareContent(shareContent);
if (!BuildConfig.QQ_APPID.isEmpty() && !BuildConfig.QQ_APPKEY.isEmpty()) {
// Add QQ
UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(this, BuildConfig.QQ_APPID, BuildConfig.QQ_APPKEY);
qqSsoHandler.addToSocialSDK();
QQShareContent qqShareContent = new QQShareContent();
qqShareContent.setShareContent(shareContent);
qqShareContent.setTitle(title);
qqShareContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());
socialService.setShareMedia(qqShareContent);
} else {
socialService.getConfig().removePlatform(SHARE_MEDIA.QQ);
}
if (!BuildConfig.WX_APPID.isEmpty() && !BuildConfig.WX_SECRET.isEmpty()) {
// Add WeiChat
UMWXHandler wxHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
wxHandler.addToSocialSDK();
// Add WeChat Circle
UMWXHandler wxCircleHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
//设置微信分享内容
WeiXinShareContent weixinContent = new WeiXinShareContent();
weixinContent.setShareContent(shareContent);
weixinContent.setTitle(title);
weixinContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());
weixinContent.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
socialService.setShareMedia(weixinContent);
Logger.d(topicInfo.getUser().getData().getAvatar());
//设置微信朋友圈分享内容
CircleShareContent circleMedia = new CircleShareContent();
circleMedia.setShareContent(shareContent);
circleMedia.setTitle(title);
circleMedia.setTargetUrl(this.topicInfo.getLinks().getWebURL());
circleMedia.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
socialService.setShareMedia(circleMedia);
}else{
socialService.getConfig().removePlatform(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE);
}
socialService.openShare(this, false);
}
示例15: initShare
import com.umeng.socialize.weixin.controller.UMWXHandler; //导入方法依赖的package包/类
private void initShare() {
// 添加微信平台
UMWXHandler wxHandler = new UMWXHandler(WebDisplay.this, "1104819871", "uwPxPLJVBlwteKeK");
wxHandler.addToSocialSDK();
// 添加微信朋友圈
UMWXHandler wxCircleHandler = new UMWXHandler(WebDisplay.this, "1104819871", "uwPxPLJVBlwteKeK");
wxCircleHandler.setToCircle(true);
wxCircleHandler.addToSocialSDK();
/**
* 分享到QQ好友和控件
*/
// 参数1为当前Activity,参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY.
UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(WebDisplay.this, "1104819871",
"uwPxPLJVBlwteKeK");
qqSsoHandler.addToSocialSDK();
QQShareContent qqShareContent = new QQShareContent();
//设置分享文字
qqShareContent.setShareContent("来自彩阅的分享-彩阅,精彩你的每一天!");
//设置分享title
qqShareContent.setTitle(title);
//设置分享图片
//qqShareContent.setShareImage(new UMImage(getActivity(), R.drawable.icon));
//设置点击分享内容的跳转链接
qqShareContent.setTargetUrl(url);
mController.setShareMedia(qqShareContent);
// 参数1为当前Activity,参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY.
QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(WebDisplay.this, "1104819871",
"uwPxPLJVBlwteKeK");
qZoneSsoHandler.addToSocialSDK();
QZoneShareContent qzone = new QZoneShareContent();
//设置分享文字
qzone.setShareContent("来自彩阅的分享-彩阅,精彩你的每一天!");
//设置点击消息的跳转URL
qzone.setTargetUrl(url);
//设置分享内容的标题
qzone.setTitle(title);
//设置分享图片
//qzone.setShareImage(urlImage);
mController.setShareMedia(qzone);
}