Last Updated on : 2025-11-26 07:14:55download
The Advanced Functions UI BizBundle provides a container for Android that hosts the app’s advanced functions value-added services.
Service subscription currently requires no additional fees. Once you subscribe to the services, the Tuya personnel will be notified and process your request. You will receive a notification for contract signing. Please wait patiently.
The following services are available:
Integrate SmartLife App SDK for Android into your project with Android Studio, and add the UI BizBundle to your project. For more information, see Integrate with Framework for Android.
dependencies {
api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:${biz_bom_version}")
implementation 'com.thingclips.smart:thingsmart-bizbundle-third_service'
api "com.thingclips.smart:thingsmart:${sdk_version}}"
}
Suppose the UI BizBundle you want to integrate involves in-app payment services and requires distribution through the Google Store. In that case, you must additionally integrate the service components related to Google Identity-Aware Proxy (IAP).
dependencies {
api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:${biz_bom_version}")
implementation 'com.thingclips.smart:thingsmart-bizbundle-google_pay'
}
Meanwhile, override the following resources by setting them to true:
Google IAP support:
<bool name="is_support_google_iap">true</bool>
Alternative billing support (refer to Alternative billing APIs):
<bool name="enableUserChoiceBillingg">true</bool>
# Obfuscates the code of all third-party dependencies in build.gradle.
# fastJson
-keep class com.alibaba.fastjson.**{*;}
-dontwarn com.alibaba.fastjson.**
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-keep class okio.** { *; }
-dontwarn okio.**
-keep class com.thingclips.**{*;}
-dontwarn com.thingclips.**
The miniapp solution is supported starting from SDK v6.11, providing unified APIs to retrieve and launch various smart miniapps. It enables access to more value-added services and is recommended as the preferred approach.
Supported services:
Create callback interfaces. First, implement the IDataIntelligenceCallback interface.
private val intelligenceCallback = object : IDataIntelligenceCallback {
override fun onSuccess(data: ArrayList<IntelligenceOpenBean>) {
// Process successfully retrieved data
data.forEach { bean ->
println("Miniapp Name: ${bean.name}")
println("Miniapp Description: ${bean.desc}")
println("Icon URL: ${bean.picture}")
println("Redirect Link: ${bean.link}")
}
}
override fun onError(code: String, message: String) {
// Handle error cases
println("Error Code: $code, Error Message: $message")
}
}
Get the smart miniapp data. Call the manager method to fetch data.
ThingSmartIntelligenceManager.getIntelligenceOpenData(intelligenceCallback)
Open the smart miniapp. For information on how to integrate the miniapp SDK, refer to the Miniapp SDK Integration Guide.
Open by miniapp ID:
ThingMiniAppClient
.coreClient()
.openMiniAppByAppId(context, entranceMark, null, null)
Open by miniapp link:
ThingMiniAppClient
.coreClient()
.openMiniAppByUrl(context, link, null)
IntelligenceOpenBean
| Field | Type | Description |
|---|---|---|
| id | String | The unique identifier for a miniapp. |
| entranceMark | String | The value of appId for the miniapp. |
| name | String | The name of the miniapp. |
| desc | String | The description of the miniapp. |
| picture | String | The icon URL of the miniapp. |
| link | String | The redirect link of the miniapp. |
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Get smart miniapp data
ThingSmartIntelligenceManager.getIntelligenceOpenData(
object : IDataIntelligenceCallback {
override fun onSuccess(data: ArrayList<IntelligenceOpenBean>) {
runOnUiThread {
// Update UI in the thread
updateUI(data)
}
}
override fun onError(code: String, message: String) {
runOnUiThread {
// Show an error message
Toast.makeText(
this@MainActivity,
"Failed to get data: $message",
Toast.LENGTH_SHORT
).show()
}
}
}
)
}
private fun updateUI(data: ArrayList<IntelligenceOpenBean>) {
// Update UI logic
data.forEach { bean ->
// Process each miniapp data
// Example: add to the list and show an icon
}
}
/**
* Open the specified miniapp
*/
private fun openMiniApp(bean: IntelligenceOpenBean) {
// Method 1: Open by AppID
ThingMiniAppClient
.coreClient()
.openMiniAppByAppId(this, bean.entranceMark, null, null)
// Method 2: Open by link
// ThingMiniAppClient
// .coreClient()
// .openMiniAppByUrl(this, bean.link, null)
}
}
The WebView solution currently only supports phone notification and SMS notification services. We recommend using the miniapp solution, which enables the extension of more smart services.
Enumerate advanced function types.
public enum PersonalThirdServiceType {
// SMS notification
PUSH_SMS_SERVICE("personal_push_sms_service"),
// Phone notification
PUSH_CALL_SERVICE("personal_push_call_service");
private final String type;
PersonalThirdServiceType(String type) {
this.type = type;
}
public String getType() {
return type;
}
}
Query advanced functions. Query advanced functions based on types. An asynchronous callback is implemented.
API description
void requestPersonalThirdService(long homeId, PersonalThirdServiceType type, IPersonalThirdServiceCallback callback)
Parameters
| Parameter | Description |
|---|---|
| HomeId | The ID of the currently selected home. |
| PersonalThirdServiceType | The type of an advanced function. |
| IPersonalThirdServiceCallback | The asynchronous callback of querying the advanced functions. |
Example
AbsPersonalThirdService thirdService = MicroContext.getServiceManager()
.findServiceByInterface(AbsPersonalThirdService.class.getName());
thirdService.requestPersonalThirdService(homeId, PersonalThirdServiceType.PUSH_SMS_SERVICE,
new IPersonalThirdServiceCallback() {
@Override
public void onSuccess(ThirdIntegrationBean bean) {
String url = bean != null ? bean.getUrl() : null;
Log.i("third_service", "url = " + url);
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Open an advanced function page. Displays an advanced function page by means of activities or fragments. Example:
Activity
Intent intent = new Intent(context, WebViewActivity.class);
intent.putExtra("Uri", url);
context.startActivity(intent);
Fragment
WebViewFragment fragment = new WebViewFragment();
Bundle args = new Bundle();
args.putString("Uri", url);
args.putBoolean("enableLeftArea", true);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.add(R.id.web_content, fragment, WebViewFragment.class.getSimpleName())
.commit();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback