registerExtension
The registerExtension API is used by the super app to implement the customized functions provided by the mini program container.
Method signature
void registerExtension(GriverExtensionManifest extensionManifest, GriverContainerAPICallBack callBack)Request parameters
Name | Type | Description | Required |
extensionManifest | The object of the extension. | M | |
callBack | The callback that is used to return the result of the extension registration. | O |
Response parameters
Name | Type | Description | Required |
error | An object that is used to return the error code and error message when the registration fails. | O |
Error codes
Error code | Error message | Further action | |
90002 | GRV_CONTAINER_NOT_INITIALIZED | IAPMiniProgram SDK is not initialized. | Initialize the SDK. |
90003 | GRV_CONTAINER_ERROR_UNKNOWN | The request parameters are not specified correctly. | Refer to the Request parameters table and check if all parameter types are correct and if all required parameters are specified. |
Samples
Kotlin
class GriverLocalAuthDialogExtensionImpl: GriverLocalAuthDialogExtension {
override fun createDialog(context: Context): LocalPermissionDialog {
return NebulaLocalPermissionNoticeDialog(context);
}
}
Griver.registerExtension(
GriverExtensionManifest(
GriverLocalAuthDialogExtensionImpl::class.java,
GriverLocalAuthDialogExtensionImpl()
)
)Java
public class GriverLocalAuthDialogExtensionImpl implements GriverLocalAuthDialogExtension {
@Override
public LocalPermissionDialog createDialog(Context context) {
return new NebulaLocalPermissionNoticeDialog(context);
}
}
Griver.registerExtension(new GriverExtensionManifest(GriverLocalAuthDialogExtensionImpl.class, new GriverLocalAuthDialogExtensionImpl()));