Last Updated on : 2023-07-03 03:04:44download
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.thingclips.smart:thingsmart-bizbundle-share:2.0.0-cube.2'
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()
// 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