supersdk

文档中心

文档中心

下载文档

MobShareSDK module


MobShareSDK provides sharing functions such as WeChat, Weibo, QQ, Facebook, and Twitter.

Precautions

Parameters of WeChat, Weibo, QQ, Facebook, Twitter and other platforms needs to be applied.

Engineering configuration

Download the MobShareSDK module jar package from the official website and import it into the project.

 "MobCommons-2019.0627.1129.jar",
 "MobTools-2019.0627.1129.jar",
 "ShareSDK-Core-3.6.1.jar",
 "module-mobsharesdk.jar"

Sharing interface

Interface invoke:

 Map<String,Object> map=new HashMap<>();
	map.put("title","标题"); //必传参数
	map.put("content","我是分享文本");  //必传参数
	map.put("titleUrl","标题链接");  //Android qq空间必传此参数,其他平台可不传
	map.put("images","https://p.ssl.qhimg.com/dmfd/400_300_/t0120b2f23b554b8402.jpg");//分享图片的网络地址或本地路径,参数必须为string类型
	map.put("url","https://www.baidu.com/");//分享的url
	map.put("platform","1");//该字段选传,不传会拉起ShareSDK默认分享UI,传了则不会拉起UI,直接调用对应平台分享接口,参数为string类型:
										 新浪微博 1,
                    					 微信好友 2,
                    					 微信朋友圈 3,
                    					 微信收藏 4,
                    					 QQ好友 5,
                    					 QQ空间 6,
                    					 Facebook 7,
                    					 Instagram 8,
                    					 KakaoTalk 9,
                    					 KakaoStory 10,
                    					 Line 11,
                    					 Twitter 12,
                    					 VKontakte 13,
 SuperSDK.invoke("mobsharesdk", "mobShare", map);;

Interface callback:

 private OnSuperSDKListener mSuperSDKListener = new OnSuperSDKListener() {
		@Override
		public void onSuperSDK(String moduleName, String funcName, String result) {
			if("mobsharesdk".equals(moduleName)&& "mobShare".equals(funcName){
				JSONObject json = JsonUtils.parseObject(result);
				int code = json.getIntValue("code");
				if (MobShareConstants.SUCCESS == code) {
					String msg = json.getString("msg");
					BCoreLog.e("分享成功");
				} else if (MobShareConstants.CANCLE == code){
					String msg = json.getString("msg");
					BCoreLog.e("分享取消,msg=" + msg);
				} else{
					String msg = json.getString("msg");
					BCoreLog.e("分享失败,msg=" + msg);
				}
			}
		}	
	}

Callback log printing:

onSuperSDK: moduleName:mobsharesdk
			funcName:mobShare
			result:{"code":1,"msg":"分享成功"}