Last Updated on : 2024-04-01 07:04:54download
The Advanced Functions UI BizBundle provides a container for Android that hosts the app’s advanced functions. The following advanced functions are available.
Integrate Smart Life 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}}"
}
# 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.**
public enum PersonalThirdServiceType {
// Short message service
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 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) {
}
});
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