更新时间:2024-10-30 10:02:35下载pdf
分享 UI 业务包支持三方分享能力,用户可以将信息通过微信、短信、邮箱等渠道分享给其他好友。
appkey
imagePath
在工程 module
的 build.gradle
添加配置。
dependencies {
api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:${biz_bom_version}")
api 'com.thingclips.smart:thingsmart-bizbundle-share'
api "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.0"
}
步骤详情,请参考 申请微信 appKey
在 res
资源文件中添加以下配置:
<string name="wxAppKey">微信 key</string>
//微信分享
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
//初始化微信
mShareManager?.initWxShare(wxAppId)
//判断微信是否安装
mShareManager?.isWxInstalled()
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareBySms(mContext, "share content")
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareByCopy("share content")
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareByImage(mActivity, “mImagePath”)
检查邮箱是否存在:
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.checkEmailApkExist()
邮箱分享:
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareByEmail(mActivity, “mShareTitle”, "share content", “mEmailUrl”)
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareByEmail(mContext,"share content")
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.doShareBySystemDefault(mContext, "share content")
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.launchSharePlatform(this, ShareType.TYPE_MORE, "share content")
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈