Last Updated on : 2024-11-18 11:33:16download
Sharing UI BizBundle provides the capabilities to share resources with third parties by means such as SMS, email, or WeChat.
appkey
are required.imagePath
can be shared through a system application.Add the following dependencies to the file build.gradle
of module
:
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"
}
Add the following configurations to the res
:
<string name="wxAppKey">WeChat key</string>
// Shares resources by WeChat.
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
// Returns the WeChat `AppId` and `wxAppKey`.
mShareManager?.getWxAppId()
// Checks whether WeChat is installed.
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”)
Checks whether an email address exists.
val mShareManager = MicroContext.getServiceManager().findServiceByInterface<AbsShareManager>(AbsShareManager::class.java.name)
mShareManager?.checkEmailApkExist()
Shares resources by email.
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")
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback