GriverDynamicFeatureExtension
If you want to optimize the MYWeb module dynamic download experience, for example whether a custom dialog box is displayed to explain the download reason, knowning the download status, and so on, to achieve these experiences, use the GriverDynamicFeatureExtension interface.
Note:This interface is applicable to SDK version 2.71.0 and the later versions.
Procedures
Step 1. Implement the GriverDynamicFeatureExtension interface
Implement the GriverDynamicFeatureExtension interface and write code in the required methods according to your business logic.
Code sample as follows:
public class CustomGriverDynamicFeatureExtension implements GriverDynamicFeatureExtension {
@Override
public void showDialog(DynamicFeatureDialogCallback callback, @NonNull List<? extends InstallModuleType> list) {
}
@Override
public void onUpdate(InstallSessionEnumStatus status, @NonNull List<? extends InstallModuleType> moduleTypes) {
}
@Override
public void onAlreadyInstalled(@NonNull InstallModuleType moduleType) {
}
}
Step 2: Register the CustomGriverDynamicFeatureExtension class
Refer to the following sample code and call the registerExtension interface to register after initializing the SDK.
IAPConnect.init(application, initConfig, object : InitCallback() {
override fun onSuccess() {
//···
Griver.registerExtension(
GriverExtensionManifest(
GriverDynamicFeatureExtension::class.java,
CustomGriverDynamicFeatureExtension()
)
)
}
})
Structures
GriverDynamicFeatureExtension interface
The definition of this interface is shown in the following codes:
public interface GriverDynamicFeatureExtension extends GriverExtension {
void showDialog(DynamicFeatureDialogCallback callback, @NonNull List<? extends InstallModuleType> list);
void onUpdate(InstallSessionEnumStatus status, @NonNull List<? extends InstallModuleType> list);
void onAlreadyInstalled(@NonNull InstallModuleType moduleType);
interface DynamicFeatureDialogCallback{
void onConfirm();
void onCancel();
}
}
Methods
Based on the interface definition, it provides the following methods:
Method | Description |
After the app starts and MYWeb module is ready to download, the app controls whether a custom dialog box is displayed. The logic is customized. For example, after the user refuses to view the dialog box the multiple times, the dialog will no longer pop up. | |
Callback of the MYWeb module download status. | |
Callback of the MYWeb module installation status, which is used to handle the already installed module. |
showDialog method
This method supports the following parameters:
Parameter | Data type | Required | Description |
callback | DynamicFeatureDialogCallback | Yes | When clicking Confirm or Cancel on the dialog box, the callback is passed to the SDK. |
list | List<? extends InstallModuleType> | Yes | Indicates the module type. Note: only |
onUpdate method
This method supports the following parameters:
Parameter | Data type | Required | Description |
status | InstallSessionEnumStatus | Yes | Indicates the module download status:
|
list | List<? extends InstallModuleType> | Yes | Indicates the module type. Note: only |
onAlreadyInstalled method
This method supports the following parameters:
Parameter | Data type | Required | Description |
moduleType | InstallModuleType | Yes | Indicates the module type. Note: only |