English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Mall UI BizBundle

Last Updated on : 2022-09-02 07:54:20download

Description

Mall UI BizBundle provides the iOS container that hosts Tuya’s value-added service App Mall. You can leverage the powerful mall capabilities to monetize the user traffic through your in-app store.

For more information, see App Mall.

Integrate with the UI BizBundle

Create a project

Integrate Smart Life App SDK for Android into your project with Android Studio and add the framework of the UI BizBundle to your project.

Configure the build.gradle file

dependencies {
	api 'com.tuya.smart:tuyasmart-bizbundle-mall:4.2.0-22'
}

Obfuscate the code

# 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.tuya.**{*;}
-dontwarn com.tuya.**

Implement features

Check mall availability

Checks whether the location of the current user supports the app mall business.

API description

isSupportMall()

Example

TuyaMallService service = MicroContext.getServiceManager().findServiceByInterface(TuyaMallService.class.getName());
    boolean mallEnable = service.isSupportMall()

Query URL of mall homepage

Returns the URL of the mall homepage if the user’s location supports the app mall business. An asynchronous callback is implemented.

API description

requestMallHome(IGetMallUrlCallback callback)

Parameters

Parameter Description
IGetMallUrlCallback The asynchronous callback.

Example

TuyaMallService service = MicroContext.getServiceManager().findServiceByInterface(TuyaMallService.class.getName());
    service.requestMallHome(new IGetMallUrlCallback() {
        @Override
        public void onSuccess(String url) {
            Log.i("mall url = ",url);
        }
        @Override
        public void onError(String code, String error) {
        }
    });

Query URL of mall order

Returns the URL of a mall order in the user’s location. An asynchronous callback is implemented.

API description

requestMallUserCenter(IGetMallUrlCallback callback)

Parameters

Parameter Description
IGetMallUrlCallback The asynchronous callback of the mall order request.

Example

TuyaMallService service = MicroContext.getServiceManager().findServiceByInterface(TuyaMallService.class.getName());
    service.requestMallUserCenter(new IGetMallUrlCallback() {
        @Override
        public void onSuccess(String url) {
            Log.i("mall user center url = ", url);
        }
        @Override
        public void onError(String code, String error) {
        }
    });

Open a mall page

Displays a mall 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();