更新时间:2024-11-18 11:33:11下载pdf
分享 UI 业务包支持三方分享能力,用户可以将信息通过微信、短信、邮箱等渠道分享给其他好友。
appkey
imagePath
在工程 module
的 build.gradle
添加配置。
dependencies {
api 'com.tuya.smart:tuyasmart-bizbundle-share:4.2.0-33'
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)
//获取微信AppId,配置的wxAppKey
mShareManager?.getWxAppId()
//判断微信是否安装
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")
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈