Java Code Examples for cn.sharesdk.onekeyshare.OnekeyShare#setSilent()

The following examples show how to use cn.sharesdk.onekeyshare.OnekeyShare#setSilent() . 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: ShareUtil.java    From AndroidLinkup with GNU General Public License v2.0 5 votes vote down vote up
private void showShare(OnekeyShare oks) {
    // 关闭sso授权
    // oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字
    oks.setNotification(R.drawable.ic_launcher, context.getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(context.getString(R.string.share_top_info));
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl(ViewSettings.WebRoot);
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl(ViewSettings.WebRoot);
    // 评论
    oks.setComment(context.getString(R.string.share_comment));
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(context.getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl(ViewSettings.WebRoot);

    oks.setSilent(true);

    // 设置分享
    oks.setCallback(new OneKeyShareCallback());

    // 启动分享GUI
    oks.show(context);
}
 
Example 2
Source File: MainActivity.java    From -Android_ShareSDK_Example_Wechat with MIT License 4 votes vote down vote up
@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);
		
	}
}