摘要:百度超过千亿的中文网页数据库,可以瞬间找到相关的搜索结果。小程序类型正式版,测试版,体验版小程序小程序页面地址自定义图标需要集成图片库
SocialComponent
社会化组件
集成步骤1、依赖library库
2、给Project的build.gradle文件添加如下代码:
allprojects { repositories { google() jcenter() mavenCentral() maven { url "https://dl.bintray.com/thelasterstar/maven/" } } }
3、配制AndroidManifest.xml,添加如下代码:
4、在自己的包名下添加wxapi包及里面的所有java文件
5、在自定义的Application中初始化
//初始化数据 SocialHelper.get().setQqAppId("1107009250") .setWxAppId("wx2847b18acb41e535") .setWxAppSecret("78f713b76c61a38242e63ccdb3a96d68") .setWbAppId("2214687859") .setWbRedirectUrl("https://github.com/fengqingxiuyi");功能详情
各功能使用详情,请参考MainActivity.java
例如:
/** * 分享 */ public void jump2Share(View view) { ShareDataBean shareDataBean = new ShareDataBean(); HashMapshareTypeList = new HashMap<>(); shareTypeList.put(ISocialType.SOCIAL_WX_SESSION, WXShareHelper.TYPE_WEB); shareTypeList.put(ISocialType.SOCIAL_WX_TIMELINE, WXShareHelper.TYPE_WEB); shareTypeList.put(ISocialType.SOCIAL_WX_MINIPROGRAM, WXShareHelper.TYPE_MINIPROGRAM); shareTypeList.put(ISocialType.SOCIAL_QQ, QQShareHelper.TYPE_IMAGE_TEXT); shareTypeList.put(ISocialType.SOCIAL_WB, WBShareHelper.TYPE_TEXT); shareDataBean.shareType = shareTypeList; shareDataBean.shareTitle = "百度一下,你就知道"; shareDataBean.shareDesc = "全球最大的中文搜索引擎、致力于让网民更便捷地获取信息,找到所求。百度超过千亿的中文网页数据库,可以瞬间找到相关的搜索结果。"; shareDataBean.shareImage = "https://www.baidu.com/img/bd_logo1.png"; shareDataBean.shareUrl = "https://www.baidu.com/"; shareDataBean.shareMiniType = 0; //小程序类型 - 正式版:0,测试版:1,体验版:2 shareDataBean.shareMiniAppId = "gh_64c734bc4b8d"; //小程序AppId shareDataBean.shareMiniPage = "pages/fitting-room/index"; //小程序页面地址 ArrayList socialTypeBeans = new ArrayList<>(); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_WX_SESSION)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_WX_TIMELINE)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_SMS)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_COPY)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_REFRESH)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_CUSTOM, "https://img.ezprice.com.tw/is/c.rimg.com.tw/s1/4/7e/29/21628111029801_843_s.jpg", "自定义图标需要集成图片库")); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_QQ)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_WB)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_WX_MINIPROGRAM)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_ALIPAY)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_COLLECTION)); socialTypeBeans.add(new SocialTypeBean(ISocialType.SOCIAL_SHOW_ALL)); SocialHelper.get().share(this, socialTypeBeans, shareDataBean, new IShareCallback() { @Override public void onSuccess(int socialType, String msg) { Toast.makeText(MainActivity.this, "MainActivity onSuccess, socialType = " + socialType +", msg = " + msg, Toast.LENGTH_SHORT).show(); } @Override public void onError(int socialType, String msg) { Toast.makeText(MainActivity.this, "MainActivity onError, socialType = " + socialType +", msg = " + msg, Toast.LENGTH_SHORT).show(); } @Override public void onCancel(int socialType) { Toast.makeText(MainActivity.this, "MainActivity onCancel, socialType = " + socialType, Toast.LENGTH_SHORT).show(); } }); }
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/76751.html
摘要:我不听,我就是这么命名。任何服务启动以后,都会把自己注册到的注册表中当服务死亡的时候,也会通知。服务拿到结果后,会把结果缓存在本地的注册表里。根据负载均衡策略,从注册表中选择一个真正的实例地址。 原创:小姐姐味道(微信公众号ID:xjjdog),欢迎分享,转载请保留出处。 这几天可真是热啊,泡个海澡是再好不过了。玩的正起劲,突然脚底绊上一股暗流,然后我就一直在水里旋转旋转旋转...终于...
阅读 1341·2023-04-25 16:45
阅读 1883·2021-11-17 09:33
阅读 2285·2021-09-27 14:04
阅读 897·2019-08-30 15:44
阅读 2584·2019-08-30 14:24
阅读 3379·2019-08-30 13:59
阅读 1676·2019-08-29 17:00
阅读 863·2019-08-29 15:33