Last Updated on : 2024-04-01 06:56:38download
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 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"
api "com.thingclips.smart:thingsmart:${sdk_version}}"
}
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)
// Initializes the WeChat app.
mShareManager?.initWxShare(wxAppId)
// 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