Jump to: navigation, search

Share System API

Sharing System Introduction

Sharing System has adopted the one-click technology from ShareSDK and currently supports sharing to Sina Weibo, Qzone, WeChat(to a contact, moments or favorites), QQ contacts, Tencent Weibo, Renren, Yixin(to a contact or circle).

Related APIs

Sharing

void share(TShareInfo info);
TShareInfo is essentially a map, recording some shared related info.
The parameter chart is as below:
Parameter Must be filled or not Note
title Y Shared title,30 characters max
titleUrl Y titleUrl is the link of title
site Y site is the name of the sharing website
siteUrl Y siteUrl is the address of the sharing website
Text sharing text N shared text, 130 characters max
Image sharing imagePath N imageUrl has a higher priority than imagePath, namely,if both exist,imagePath will be ignored
imageUrl N
dialogMode N Modifies the mode of shared content; by default false means full screen and true dialog window
Sharing the icon and text of Notification notifyIcon N Upon sharing, the icon and text of Notification must both exist
notifyTitle N
comment comment Y Comment of the content; cannot be empty when sharing with Renren

About Sharing Callback

Callback Info. code msg
Sharing Succeeds kShareSuccess null of simple description of error
Sharing Failed kShareCancel null of simple description of error
Sharing Failed kShareFail null of simple description of error
Shaing Network Error kShareNetworkError null of simple description of error

Take An Example

if(AgentManager::getInstance()->getSharePlugin())
{

	std::map<std::string, std::string> info;
	info["title"] ="ShareSDK is an amazing SDK";
	info["titleUrl"] = "http://sharesdk.cn";
	info["site"] = "ShareSDK";
	info["siteUrl"] = "http://sharesdk.cn";
	info["text"] = "ShareSDK supports social platforms like WeChat, Sina Weibo, Tencent Weibo, etc";
        info["comment"] = "None";
	AgentManager::getInstance()->getSharePlugin()->share(info);
}

switch(ret)
{
	case kShareSuccess://Callback of successful sharing
             break;
	case kShareFail://Callback of failed sharing
             break;
        case kShareCancel://Callback of cancelled sharing
             break;
	case kShareNetworkError://Callback of sharing network error
             break;
        default:
             break;
}