Java Code Examples for cn.sharesdk.onekeyshare.OnekeyShare#setPlatform()
The following examples show how to use
cn.sharesdk.onekeyshare.OnekeyShare#setPlatform() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SharePresenter.java From enjoyshop with Apache License 2.0 | 6 votes |
/** * 分享 */ private void share(String platform) { dialog.dismiss(); OnekeyShare oks = new OnekeyShare(); //指定分享的平台,如果为空,还是会调用九宫格的平台列表界面 if (platform != null) { oks.setPlatform(platform); } //关闭sso授权 oks.disableSSOWhenAuthorize(); oks.setTitle(title); oks.setTitleUrl("http://www.baidu.com"); oks.setText(description); oks.setUrl("http://sharesdk.cn"); oks.setSite("来自轻松购的分享"); oks.setSiteUrl("http://www.baidu.com"); // 启动分享GUI oks.show(mActivity); }
Example 2
Source File: MainActivity.java From ShareSDKShareDifMsgDemo-Android with MIT License | 6 votes |
private void showShare(boolean silent, String platform){ final OnekeyShare oks = new OnekeyShare(); oks.setNotification(R.drawable.ic_launcher, this.getString(R.string.app_name)); //不同平台的分享参数,请看文档 //http://wiki.mob.com/Android_%E4%B8%8D%E5%90%8C%E5%B9%B3%E5%8F%B0%E5%88%86%E4%BA%AB%E5%86%85%E5%AE%B9%E7%9A%84%E8%AF%A6%E7%BB%86%E8%AF%B4%E6%98%8E String text = this.getString(R.string.share_title) + "http://www.mob.com"; oks.setTitle("share title"); oks.setText(text); //oks.setSilent(silent); oks.setDialogMode(); oks.disableSSOWhenAuthorize(); if (platform != null) { oks.setPlatform(platform); } // 去自定义不同平台的字段内容 // http://wiki.mob.com/Android_%E5%BF%AB%E6%8D%B7%E5%88%86%E4%BA%AB#.E4.B8.BA.E4.B8.8D.E5.90.8C.E5.B9.B3.E5.8F.B0.E5.AE.9A.E4.B9.89.E5.B7.AE.E5.88.AB.E5.8C.96.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9 oks.setShareContentCustomizeCallback(new ShareContentCustomizeDemo()); oks.show(this); }
Example 3
Source File: NewsDetailActivity.java From LiuAGeAndroid with MIT License | 5 votes |
/** * 分享 */ private void showShare(String platform) { OnekeyShare oks = new OnekeyShare(); //指定分享的平台,如果为空,还是会调用九宫格的平台列表界面 if (platform != null) { oks.setPlatform(platform); } // 关闭sso授权 oks.disableSSOWhenAuthorize(); // title标题,印象笔记、邮箱、信息、微信、人人网、QQ和QQ空间使用 oks.setTitle(detailBean.getTitle()); // titleUrl是标题的网络链接,仅在Linked-in,QQ和QQ空间使用 oks.setTitleUrl(detailBean.getTitleurl()); // text是分享文本,所有平台都需要这个字段 oks.setText(detailBean.getSmalltext()); //分享网络图片,新浪微博分享网络图片需要通过审核后申请高级写入接口,否则请注释掉测试新浪微博 if (!TextUtils.isEmpty(detailBean.getTitlepic())) { oks.setImageUrl(detailBean.getTitlepic()); } else { // 默认图片,放服务器 oks.setImageUrl(APIs.BASE_URL + "icon.png"); } // url仅在微信(包括好友和朋友圈)中使用 oks.setUrl(detailBean.getTitleurl()); // site是分享此内容的网站名称,仅在QQ空间使用 oks.setSite("PCB世界"); // siteUrl是分享此内容的网站地址,仅在QQ空间使用 oks.setSiteUrl(detailBean.getTitleurl()); // 启动分享GUI oks.show(mContext); LogUtils.d(TAG, "分享url = " + detailBean.getTitleurl()); }
Example 4
Source File: NewsDetailActivity.java From BaoKanAndroid with MIT License | 5 votes |
/** * 分享 */ private void showShare(String platform) { OnekeyShare oks = new OnekeyShare(); //指定分享的平台,如果为空,还是会调用九宫格的平台列表界面 if (platform != null) { oks.setPlatform(platform); } // 关闭sso授权 oks.disableSSOWhenAuthorize(); // title标题,印象笔记、邮箱、信息、微信、人人网、QQ和QQ空间使用 oks.setTitle(detailBean.getTitle()); // titleUrl是标题的网络链接,仅在Linked-in,QQ和QQ空间使用 oks.setTitleUrl(detailBean.getTitleurl()); // text是分享文本,所有平台都需要这个字段 oks.setText(detailBean.getSmalltext()); //分享网络图片,新浪微博分享网络图片需要通过审核后申请高级写入接口,否则请注释掉测试新浪微博 if (!TextUtils.isEmpty(detailBean.getTitlepic())) { oks.setImageUrl(detailBean.getTitlepic()); } else { // 默认图片,放服务器 oks.setImageUrl("http://www.baokan.tv/d/file/p/2017-01-05/8c81061deb5b31ce6fb8e3a018afe8e5.jpg"); } // url仅在微信(包括好友和朋友圈)中使用 oks.setUrl(detailBean.getTitleurl()); // site是分享此内容的网站名称,仅在QQ空间使用 oks.setSite("爆侃网文"); // siteUrl是分享此内容的网站地址,仅在QQ空间使用 oks.setSiteUrl(detailBean.getTitleurl()); // 启动分享GUI oks.show(mContext); }
Example 5
Source File: ShareUtil.java From CatchPiggy with GNU General Public License v3.0 | 4 votes |
public static void shareToWeChat(Context context, boolean isRequestHelp, String message) { OnekeyShare onekeyShare = getData(context, isRequestHelp, message); onekeyShare.setPlatform(Wechat.NAME); onekeyShare.show(context); }
Example 6
Source File: ShareUtil.java From CatchPiggy with GNU General Public License v3.0 | 4 votes |
public static void shareToWeChatMoments(Context context, boolean isRequestHelp, String message) { OnekeyShare onekeyShare = getData(context, isRequestHelp, message); onekeyShare.setPlatform(WechatMoments.NAME); onekeyShare.show(context); }
Example 7
Source File: ShareUtil.java From CatchPiggy with GNU General Public License v3.0 | 4 votes |
public static void shareToQQ(Context context, boolean isRequestHelp, String message) { OnekeyShare onekeyShare = getData(context, isRequestHelp, message); onekeyShare.setPlatform(QQ.NAME); onekeyShare.show(context); }
Example 8
Source File: ShareUtil.java From CatchPiggy with GNU General Public License v3.0 | 4 votes |
public static void shareToQZone(Context context, boolean isRequestHelp, String message) { OnekeyShare onekeyShare = getData(context, isRequestHelp, message); onekeyShare.setPlatform(QZone.NAME); onekeyShare.show(context); }
Example 9
Source File: MainActivity.java From -Android_ShareSDK_Example_Wechat with MIT License | 4 votes |
@Override public void onClick(View v) { if(v.getId() == R.id.button1){ //快捷分享,没有九宫格,只有编辑页 //Using onekeyshare library to share wechat OnekeyShare oks = new OnekeyShare(); // 分享时Notification的图标和文字 //Settig the notification of picture and content on the status bar when share successfully oks.setNotification(R.drawable.ic_launcher, "Gtpass"); //设置默认微博平台,例如腾讯微博的,可以是TencentWeibo.NAME //Setting the share platform //If it is not been setted, that will show the Nine Grid Palace oks.setPlatform(Wechat.NAME); //分享纯文本 //微信分享必须要有text和title这两个参数 //不同的分享类型,分享参数不一样,可以参考sample中wechatpage这个类 //参数文档:http://sharesdk.cn/androidDoc/index.html?cn/sharesdk/framework/Platform.html //Share the text and title to a wechat friend //the document of the params are required when wechat share,http://sharesdk.cn/androidDoc/index.html?cn/sharesdk/framework/Platform.html oks.setText("ShareSDK share text"); oks.setTitle("ShareSDK share title"); oks.setSilent(true); oks.show(MainActivity.this); }else if (v.equals(ctvStWm)) { //微信朋友圈,wechat moment ctvStWm.setChecked(!ctvStWm.isChecked()); findViewById(R.id.btnApp).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); findViewById(R.id.btnAppExt).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); findViewById(R.id.btnFile).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); return; }else{ //微信好友,wechat friend String name = ctvStWm.isChecked() ? WechatMoments.NAME : Wechat.NAME; Platform plat = ShareSDK.getPlatform(MainActivity.this, name); plat.setPlatformActionListener(this); ShareParams sp = ctvStWm.isChecked() ? getWechatMomentsShareParams(v) : getWechatShareParams(v); plat.share(sp); } }