### Complete Mini App Activity Implementation Source: https://rakutentech.github.io/android-miniapp/docs/5.6 A full example demonstrating lifecycle management, error handling, and custom MiniAppMessageBridge implementation within an Activity. ```kotlin class MiniAppActivity : Activity(), CoroutineScope { override val coroutineContext = Dispatchers.Main private var miniAppDisplay: MiniAppDisplay override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.loading) launch { try { miniAppDisplay = withContext(Dispatchers.IO) { MiniApp.instance().create("MINI_APP_ID", createMessageBridge()) } val miniAppView = miniAppDisplay.getMiniAppView(this@MiniAppActivity) setContentView(miniAppView) } catch (e: MiniAppSdkException) { setContentView(R.layout.error_screen) } } } override fun onDestroy() { super.onDestroy() miniAppDisplay.destroyView() } fun createMessageBridge() = object : MiniAppMessageBridge() { override fun getUniqueId( onSuccess: (uniqueId: String) -> Unit, onError: (message: String) -> Unit ) { if (...) onSuccess("your-unique-id") else onError("your-error-message") } override fun requestPermission( miniAppPermissionType: MiniAppPermissionType, callback: (isGranted: Boolean) -> Unit ) { // Implementation details to request device permissions callback.invoke(true) } // You can additionally implement other MiniAppMessageBridge methods } } ``` -------------------------------- ### Initialize Mini App with Parameters Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Pass query parameters to a Mini App by configuring MiniAppParameters and calling the load function. ```kotlin class MiniAppActivity : Activity(), CoroutineScope { override fun onCreate(savedInstanceState: Bundle?) { //... val param = MiniAppParameters.DefaultParams( context = this, config = MiniAppConfig( miniAppSdkConfig = miniAppSdkConfig, miniAppMessageBridge = miniAppMessageBridge, miniAppNavigator = miniAppNavigator, miniAppFileChooser = miniAppFileChooser, queryParams = "" ), miniAppId = "id", miniAppVersion = "version", fromCache = false ) val miniapp = MiniAppView.init(param) miniapp.load(queryParams = urlParameters) { display, exception -> } //... } } ``` -------------------------------- ### MiniAppSdkConfig(baseUrl, rasProjectId, subscriptionKey, hostAppVersionId, hostAppUserAgentInfo, isPreviewMode, requireSignatureVerification, miniAppAnalyticsConfigList, sslPinningPublicKeyList, enableH5Ads, maxStorageSizeLimitInBytes) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app-sdk-config/-mini-app-sdk-config.html Initializes a new instance of the MiniAppSdkConfig with the provided configuration settings. ```APIDOC ## MiniAppSdkConfig Constructor ### Description Initializes the configuration object required for the Mini App SDK. This constructor sets up essential parameters such as the base URL, project credentials, and various feature flags. ### Signature `fun MiniAppSdkConfig(baseUrl: String, rasProjectId: String, subscriptionKey: String, hostAppVersionId: String = "", hostAppUserAgentInfo: String, isPreviewMode: Boolean, requireSignatureVerification: Boolean = false, miniAppAnalyticsConfigList: List = emptyList(), sslPinningPublicKeyList: List = emptyList(), enableH5Ads: Boolean = false, maxStorageSizeLimitInBytes: String = "52428800")` ### Parameters - **baseUrl** (String) - The base URL for the Mini App SDK. - **rasProjectId** (String) - The RAS project identifier. - **subscriptionKey** (String) - The subscription key for authentication. - **hostAppVersionId** (String) - Optional. The version ID of the host application. - **hostAppUserAgentInfo** (String) - User agent information for the host application. - **isPreviewMode** (Boolean) - Flag to enable or disable preview mode. - **requireSignatureVerification** (Boolean) - Optional. Flag to enable signature verification. - **miniAppAnalyticsConfigList** (List) - Optional. List of analytics configurations. - **sslPinningPublicKeyList** (List) - Optional. List of public keys for SSL pinning. - **enableH5Ads** (Boolean) - Optional. Flag to enable H5 ads. - **maxStorageSizeLimitInBytes** (String) - Optional. The maximum storage size limit in bytes. ``` -------------------------------- ### onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.navigator/-mini-app-download-navigator/on-file-download-start.html Notifies the host application that a file should be downloaded. This is triggered when a mini app downloads a file via JavaScript XHR, providing the base64 data string for decoding. ```APIDOC ## onFileDownloadStart ### Description Notify the host application that a file should be downloaded. This method is triggered when a mini app downloads a file via JavaScript XHR. Note that the URL received is a base64 data string that must be decoded to bytes. ### Signature `abstract fun onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long)` ### Parameters - **url** (String) - The full url to the content that should be downloaded. - **userAgent** (String) - The user agent to be used for the download. - **contentDisposition** (String) - Content-disposition http header, if present. - **mimetype** (String) - The mimetype of the content reported by the server. - **contentLength** (Long) - The file size reported by the server. ``` -------------------------------- ### HostEnvironmentInfo(Activity, String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.js.hostenvironment/-host-environment-info/-host-environment-info.html Initializes HostEnvironmentInfo using an Activity and a locale string. ```APIDOC ## HostEnvironmentInfo(activity: Activity, hostLocale: String) ### Description Initializes a new instance of HostEnvironmentInfo using the provided Android Activity and host locale. ### Parameters - **activity** (Activity) - The current Android Activity. - **hostLocale** (String) - The locale string for the host environment. ``` -------------------------------- ### init Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-view/-companion Initializes a new instance of MiniAppView using the provided MiniAppParameters. ```APIDOC ## fun init(miniAppParameters: MiniAppParameters): MiniAppView ### Description Initializes a mini app view instance required to render a mini app. ### Parameters - **miniAppParameters** (MiniAppParameters) - Required - The configuration parameters required to initialize the MiniAppView. ### Returns - **MiniAppView** - An initialized instance of the MiniAppView. ``` -------------------------------- ### onFileDownloadStart Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.navigator/-mini-app-download-navigator Notifies the host application that a file download has been initiated by the mini app. ```APIDOC ## onFileDownloadStart ### Description Notifies the host application that a file should be downloaded. ### Signature `abstract fun onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long)` ### Parameters - **url** (String) - The URL of the file to download. - **userAgent** (String) - The user agent string. - **contentDisposition** (String) - The content disposition header value. - **mimetype** (String) - The MIME type of the file. - **contentLength** (Long) - The size of the file in bytes. ``` -------------------------------- ### Simplified Mini App Creation Source: https://rakutentech.github.io/android-miniapp/docs/5.6 A basic implementation showing the initialization of a MiniAppDisplay and retrieval of the MiniAppView within a coroutine. ```kotlin try { val miniAppMessageBridge = object : MiniAppMessageBridge() { // implement methods for mini app bridge } val miniAppDisplay = withContext(Dispatchers.IO) { MiniApp.instance().create("MINI_APP_ID", miniAppMessageBridge) } val miniAppView = miniAppDisplay.getMiniAppView(this@YourActivity) // Add the view to your Activity } catch (e: MiniAppSdkException) { // Handle exception } ``` -------------------------------- ### Initialize MiniAppFileChooserDefault Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Initiate the default file chooser in the HostApp Activity. ```kotlin val fileChoosingReqCode = REQUEST_CODE // define a request code in HostApp val miniAppFileChooser = MiniAppFileChooserDefault(requestCode = fileChoosingReqCode) ``` -------------------------------- ### createWithUrl(appUrl: String, miniAppMessageBridge: MiniAppMessageBridge, miniAppNavigator: MiniAppNavigator?, miniAppFileChooser: MiniAppFileChooser?, queryParams: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/create-with-url.html Creates a mini app using the provided URL. The content is read directly from the URL and is not cached locally. ```APIDOC ## createWithUrl ### Description Creates a mini app using the provided URL. The mini app is not downloaded or cached locally; content is read directly from the URL. This method is intended for previewing mini apps from a local server. ### Signature `fun createWithUrl(appUrl: String, miniAppMessageBridge: MiniAppMessageBridge, miniAppNavigator: MiniAppNavigator? = null, miniAppFileChooser: MiniAppFileChooser? = null, queryParams: String = ""): MiniAppDisplay` ### Parameters - **appUrl** (String) - A HTTP URL containing Mini App content. - **miniAppMessageBridge** (MiniAppMessageBridge) - The interface for communicating between the host app and the mini app. - **miniAppNavigator** (MiniAppNavigator?) - Optional; allows the host app to handle specific URLs such as external links. - **miniAppFileChooser** (MiniAppFileChooser?) - Optional; allows the host app to get the file path when choosing a file inside the webview. - **queryParams** (String) - Optional; parameters to be appended to the mini app URL scheme. ### Returns - **MiniAppDisplay** - The display instance for the created mini app. ### Throws - **MiniAppNotFoundException** - Thrown when the specified Mini App URL cannot be reached. - **MiniAppSdkException** - Thrown when there is an issue during loading or creating the view. ``` -------------------------------- ### Initialize MiniAppFileDownloaderDefault Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Initiate the default file downloader in the HostApp Activity. ```kotlin val fileDownloadReqCode = REQUEST_CODE // define a request code in HostApp val MiniAppFileDownloader = MiniAppFileDownloaderDefault(activity, requestCode = fileDownloadReqCode) ``` -------------------------------- ### HostEnvironmentInfo(String, String, String, String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.js.hostenvironment/-host-environment-info/-host-environment-info.html Initializes HostEnvironmentInfo using explicit version and locale strings. ```APIDOC ## HostEnvironmentInfo(platformVersion: String, hostVersion: String, sdkVersion: String, hostLocale: String) ### Description Initializes a new instance of HostEnvironmentInfo using explicit versioning information and the host locale. ### Parameters - **platformVersion** (String) - The version of the platform. - **hostVersion** (String) - The version of the host application. - **sdkVersion** (String) - The version of the MiniApp SDK. - **hostLocale** (String) - The locale string for the host environment. ``` -------------------------------- ### MiniApp.create Source: https://rakutentech.github.io/android-miniapp Initializes and downloads a Mini App instance based on the provided Mini App ID and message bridge. ```APIDOC ## MiniApp.create(miniAppId: String, miniAppMessageBridge: MiniAppMessageBridge) ### Description Creates a MiniAppDisplay instance for the specified Mini App ID. This method checks for the latest version, downloads it if necessary, and handles caching. ### Parameters - **miniAppId** (String) - Required - The unique identifier of the Mini App. - **miniAppMessageBridge** (MiniAppMessageBridge) - Required - An implementation of the bridge to handle communication between the Mini App and the Host App. ### Returns - **MiniAppDisplay** - An instance representing the downloaded Mini App. ``` -------------------------------- ### InfoParams(context: Context, config: MiniAppConfig, miniAppInfo: MiniAppInfo, fromCache: Boolean) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-parameters/-info-params/-info-params.html Initializes a new instance of InfoParams with the provided context, configuration, mini app metadata, and cache preference. ```APIDOC ## InfoParams Constructor ### Description Initializes the parameters required for a MiniApp view. The context provided must be an Activity context to ensure proper functionality of standard HTML components. ### Signature `fun InfoParams(context: Context, config: MiniAppConfig, miniAppInfo: MiniAppInfo, fromCache: Boolean = false)` ### Parameters - **context** (Context) - Required - The activity context used for initializing internal services. - **config** (MiniAppConfig) - Required - The configuration object for the MiniApp. - **miniAppInfo** (MiniAppInfo) - Required - The metadata associated with the MiniApp. - **fromCache** (Boolean) - Optional - A flag to allow the host app to load the MiniApp from the cache. Defaults to false. ``` -------------------------------- ### MiniAppFileChooserDefault(requestCode: Int, miniAppCameraPermissionDispatcher: MiniAppCameraPermissionDispatcher?) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.file/-mini-app-file-chooser-default/-mini-app-file-chooser-default.html Initializes a new instance of MiniAppFileChooserDefault with a request code and an optional camera permission dispatcher. ```APIDOC ## MiniAppFileChooserDefault ### Description Initializes the file chooser component for the MiniApp SDK. This constructor sets the request code used for file selection intents and optionally provides a dispatcher for handling camera permissions. ### Parameters - **requestCode** (Int) - Required - The request code used for file choosing intents, which is utilized by the HostApp to retrieve data via Activity.onActivityResult. - **miniAppCameraPermissionDispatcher** (MiniAppCameraPermissionDispatcher?) - Optional - An implementation of the dispatcher required if the HostApp needs to grant the MiniApp access to the camera. ``` -------------------------------- ### MiniAppCloseAlertInfo(shouldDisplay: Boolean, title: String, description: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.closealert/-mini-app-close-alert-info/-mini-app-close-alert-info.html Initializes a new instance of MiniAppCloseAlertInfo with optional parameters for display status, title, and description. ```APIDOC ## Constructor: MiniAppCloseAlertInfo ### Description Creates an instance of MiniAppCloseAlertInfo to configure the close alert behavior for a Mini App. ### Signature `fun MiniAppCloseAlertInfo(shouldDisplay: Boolean = false, title: String = "", description: String = "")` ### Parameters - **shouldDisplay** (Boolean) - Optional - Determines if the close alert should be shown. Defaults to false. - **title** (String) - Optional - The title text for the close alert. Defaults to an empty string. - **description** (String) - Optional - The description text for the close alert. Defaults to an empty string. ``` -------------------------------- ### create(appInfo: MiniAppInfo, ...) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/create.html Creates a mini app using the mini app ID and version specified in MiniAppInfo. Intended for use in 'Preview Mode'. ```APIDOC ## create(appInfo: MiniAppInfo, miniAppMessageBridge: MiniAppMessageBridge, miniAppNavigator: MiniAppNavigator?, miniAppFileChooser: MiniAppFileChooser?, queryParams: String, fromCache: Boolean) ### Description Creates a mini app using the metadata provided in MiniAppInfo. This method should only be used in 'Preview Mode'. ### Parameters - **appInfo** (MiniAppInfo) - Required - Metadata of the mini app. - **miniAppMessageBridge** (MiniAppMessageBridge) - Required - Interface for communication between host app and mini app. - **miniAppNavigator** (MiniAppNavigator?) - Optional - Allows host app to handle specific URLs. - **miniAppFileChooser** (MiniAppFileChooser?) - Optional - Allows host app to handle file selection within the webview. - **queryParams** (String) - Optional - Parameters appended to the mini app URL scheme. - **fromCache** (Boolean) - Optional - Whether to load the mini app from cache. ### Throws - **MiniAppNotFoundException** - When the specified project ID does not exist on the server. - **MiniAppHasNoPublishedVersionException** - When the mini app ID exists but has no published versions. - **MiniAppSdkException** - For other issues during fetching, downloading, or creating the view. - **RequiredPermissionsNotGrantedException** - When required manifest permissions are not granted. ``` -------------------------------- ### MiniAppSdkConfig Constructor Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app-sdk-config Initializes a new instance of the MiniAppSdkConfig class with the required SDK settings. ```APIDOC ## MiniAppSdkConfig(baseUrl: String, rasProjectId: String, subscriptionKey: String, hostAppVersionId: String, hostAppUserAgentInfo: String, isPreviewMode: Boolean, requireSignatureVerification: Boolean, miniAppAnalyticsConfigList: List, sslPinningPublicKeyList: List, enableH5Ads: Boolean, maxStorageSizeLimitInBytes: String) ### Description Creates a configuration object for the Mini App SDK. This object is required to define the environment and authentication parameters for the SDK. ### Parameters - **baseUrl** (String) - Required - Base URL used for retrieving a Mini App. - **rasProjectId** (String) - Required - Project ID for the Platform API. - **subscriptionKey** (String) - Required - Subscription Key for the Platform API. - **hostAppVersionId** (String) - Optional - Version of the host app, used to determine feature compatibility. - **hostAppUserAgentInfo** (String) - Required - User Agent information from the Host App. - **isPreviewMode** (Boolean) - Required - Whether the host app uses API Endpoints under 'Preview' mode. - **requireSignatureVerification** (Boolean) - Optional - Whether the SDK verifies the signature of a Mini App. - **miniAppAnalyticsConfigList** (List) - Optional - List of analytic configurations. - **sslPinningPublicKeyList** (List) - Optional - List of SSL pinning public keys. - **enableH5Ads** (Boolean) - Optional - Whether to enable ad placement beta. - **maxStorageSizeLimitInBytes** (String) - Optional - Maximum Secure Storage size limit in bytes (Default: 52428800). ``` -------------------------------- ### onStartFileDownload(fileName: String, url: String, headers: Map, onDownloadSuccess: (String) -> Unit, onDownloadFailed: (MiniAppDownloadFileError) -> Unit) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.file/-mini-app-file-downloader/on-start-file-download.html Initiates a file download request triggered by a MiniApp. ```APIDOC ## onStartFileDownload ### Description Initiates the download of files invoked by a MiniApp. This method allows the host app to manage the download process. ### Signature `abstract fun onStartFileDownload(fileName: String, url: String, headers: Map, onDownloadSuccess: (String) -> Unit, onDownloadFailed: (MiniAppDownloadFileError) -> Unit)` ### Parameters - **fileName** (String) - The name of the file. - **url** (String) - The download URL of the file. - **headers** (Map) - The headers associated with the file request, if any. - **onDownloadSuccess** ((String) -> Unit) - Callback containing the file name sent from the host app to the MiniApp upon success. - **onDownloadFailed** ((MiniAppDownloadFileError) -> Unit) - Callback containing a custom error message sent from the host app upon failure. ``` -------------------------------- ### Load a Mini App from Bundle Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Load the Mini App specifically from a bundle. ```kotlin miniapp.loadFromBundle { miniAppDisplay, miniAppSdkException -> if(miniAppDisplay != null) { val miniAppView = miniAppDisplay.getMiniAppView(this@MiniAppActivity) // view could be added to show the miniapp runOnUithread { rootView.addView(miniAppView) } } } ``` -------------------------------- ### Initialize Mini App view parameters Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Configure the MiniAppParameters object required for initializing the Mini App view. ```kotlin val param = MiniAppParameters.DefaultParams( context = this, config = MiniAppConfig( miniAppSdkConfig = miniAppSdkConfig, miniAppMessageBridge = miniAppMessageBridge, miniAppNavigator = miniAppNavigator, miniAppFileChooser = miniAppFileChooser, queryParams = "" ), miniAppId = "id", miniAppVersion = "version", fromCache = false ) val miniapp = MiniAppView.init(param) ``` -------------------------------- ### MiniAppConfig Constructor Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-config Initializes a new instance of MiniAppConfig with the required SDK configuration and optional bridge, navigator, file chooser, and query parameters. ```APIDOC ## Constructor: MiniAppConfig ### Description Creates a configuration object for the Mini App. ### Signature `MiniAppConfig(miniAppSdkConfig: MiniAppSdkConfig, miniAppMessageBridge: MiniAppMessageBridge, miniAppNavigator: MiniAppNavigator?, miniAppFileChooser: MiniAppFileChooser?, queryParams: String = "")` ### Parameters - **miniAppSdkConfig** (MiniAppSdkConfig) - Required - Configuration for Mini App SDK. - **miniAppMessageBridge** (MiniAppMessageBridge) - Required - The interface for communicating between host app & mini app. - **miniAppNavigator** (MiniAppNavigator?) - Optional - Allows host app to handle specific urls such as external link. - **miniAppFileChooser** (MiniAppFileChooser?) - Optional - Allows host app to get the file path while choosing file inside the webview. - **queryParams** (String) - Optional - The parameters will be appended with the miniapp url scheme. ``` -------------------------------- ### Host(id: String, subscriptionKey: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-host/-host.html Initializes a new instance of the Host class with the specified ID and subscription key. ```APIDOC ## Host(id: String, subscriptionKey: String) ### Description Initializes a new instance of the Host class. This is used to define the host environment for the MiniApp. ### Parameters - **id** (String) - Required - The unique identifier for the host. - **subscriptionKey** (String) - Required - The subscription key associated with the host. ``` -------------------------------- ### Initialize MiniAppExternalUrlLoader for manual checks Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Initialize the loader with a null activity to enable manual control over URL transmission. ```kotlin val miniAppExternalUrlLoader = MiniAppExternalUrlLoader(miniAppId, null) ``` -------------------------------- ### UrlParams(context: Context, config: MiniAppConfig, miniAppUrl: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-parameters/-url-params/-url-params.html Initializes a new instance of UrlParams with the provided Android context, configuration, and the URL of the MiniApp. ```APIDOC ## UrlParams(context: Context, config: MiniAppConfig, miniAppUrl: String) ### Description Initializes the parameters required to load a MiniApp directly from a URL. This is intended for previewing MiniApps from a local server rather than downloading and caching them. ### Parameters - **context** (Context) - Required - The activity context used for initializing internal services and ensuring standard HTML components function correctly. - **config** (MiniAppConfig) - Required - The configuration object for the MiniApp. - **miniAppUrl** (String) - Required - The HTTP URL pointing to the MiniApp content. ``` -------------------------------- ### load(queryParams: String, fromCache: Boolean, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-view/load.html Loads a mini app view. The mini app is downloaded, saved, and provides a view when successful. ```APIDOC ## load ### Description Loads a mini app view. The mini app is downloaded, saved, and provides a view when successful. ### Signature `abstract fun load(queryParams: String = "", fromCache: Boolean = false, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit)` ### Parameters - **queryParams** (String) - Optional - The parameters to be appended with the miniapp URL scheme. - **fromCache** (Boolean) - Optional - Whether to load from the cached miniapp. - **onComplete** ((MiniAppDisplay?, MiniAppSdkException?) -> Unit) - Required - Callback function invoked when the miniapp loading process completes, providing either the MiniAppDisplay or a MiniAppSdkException. ``` -------------------------------- ### Load a Mini App Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Load the Mini App and add the resulting view to the UI hierarchy. ```kotlin miniapp.load { miniAppDisplay, miniAppSdkException -> if(miniAppDisplay != null) { val miniAppView = miniAppDisplay.getMiniAppView(this@MiniAppActivity) // view could be added to show the miniapp runOnUithread { rootView.addView(miniAppView) } } } ``` -------------------------------- ### create(appId: String, ...) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/create.html Creates a mini app using the specified app ID. The mini app is downloaded, saved, and provides a MiniAppDisplay upon success. ```APIDOC ## create(appId: String, miniAppMessageBridge: MiniAppMessageBridge, miniAppNavigator: MiniAppNavigator?, miniAppFileChooser: MiniAppFileChooser?, queryParams: String, fromCache: Boolean) ### Description Creates a mini app using the provided app ID. The mini app is downloaded, saved, and returns a MiniAppDisplay object when successful. ### Parameters - **appId** (String) - Required - The mini app ID. - **miniAppMessageBridge** (MiniAppMessageBridge) - Required - Interface for communication between host app and mini app. - **miniAppNavigator** (MiniAppNavigator?) - Optional - Allows host app to handle specific URLs. - **miniAppFileChooser** (MiniAppFileChooser?) - Optional - Allows host app to handle file selection within the webview. - **queryParams** (String) - Optional - Parameters appended to the mini app URL scheme. - **fromCache** (Boolean) - Optional - Whether to load the mini app from cache. ### Throws - **MiniAppNotFoundException** - When the specified project ID does not exist on the server. - **MiniAppHasNoPublishedVersionException** - When the mini app ID exists but has no published versions. - **MiniAppSdkException** - For other issues during fetching, downloading, or creating the view. - **RequiredPermissionsNotGrantedException** - When required manifest permissions are not granted. ``` -------------------------------- ### Implement Custom MiniAppFileDownloader Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Create a custom file downloader by implementing the MiniAppFileDownloader interface. ```kotlin val miniAppFileDownloader = object : MiniAppFileDownloader{ override fun onStartFileDownload( fileName: String, url: String, headers: Map, onDownloadSuccess: (String) -> Unit, onDownloadFailed: (MiniAppDownloadFileError) -> Unit ) { //.. Download the file } } ``` -------------------------------- ### downloadMiniApp(miniAppId: String, versionId: String, completionHandler: (success: Boolean, MiniAppSdkException?) -> Unit) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app Downloads and stores a MiniApp. ```APIDOC ### downloadMiniApp(miniAppId: String, versionId: String, completionHandler: (success: Boolean, MiniAppSdkException?) -> Unit) #### Description Downloads and stores a MiniApp. #### Parameters - **miniAppId** (String) - Required - The ID of the mini app. - **versionId** (String) - Required - The version ID of the mini app. - **completionHandler** (Function) - Required - Callback invoked upon completion. ``` -------------------------------- ### MiniAppManifest(requiredPermissions, optionalPermissions, accessTokenPermissions, customMetaData, versionId) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app-manifest/-mini-app-manifest.html Initializes a new instance of the MiniAppManifest class with the specified permissions, metadata, and version ID. ```APIDOC ## MiniAppManifest Constructor ### Description Creates a new instance of the MiniAppManifest, which defines the requirements and metadata for a Mini App. ### Signature `MiniAppManifest(requiredPermissions: List>, optionalPermissions: List>, accessTokenPermissions: List, customMetaData: Map, versionId: String)` ### Parameters - **requiredPermissions** (List>) - A list of required permissions and their associated descriptions. - **optionalPermissions** (List>) - A list of optional permissions and their associated descriptions. - **accessTokenPermissions** (List) - A list of access token scopes required by the Mini App. - **customMetaData** (Map) - A map of custom metadata key-value pairs. - **versionId** (String) - The unique identifier for the Mini App version. ``` -------------------------------- ### DefaultParams(context: Context, config: MiniAppConfig, miniAppId: String, miniAppVersion: String, fromCache: Boolean) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-parameters/-default-params/-default-params.html Constructor to initialize the MiniApp parameters. ```APIDOC ## Constructor: DefaultParams ### Description Initializes the parameters required for a MiniApp instance. ### Signature `fun DefaultParams(context: Context, config: MiniAppConfig, miniAppId: String, miniAppVersion: String, fromCache: Boolean = false)` ### Parameters - **context** (Context) - Required - The activity context used for initializing internal services. - **config** (MiniAppConfig) - Required - Configuration settings for the MiniApp. - **miniAppId** (String) - Required - The unique identifier for the MiniApp. - **miniAppVersion** (String) - Required - The version string of the MiniApp. - **fromCache** (Boolean) - Optional - Flag to allow the host app to load the MiniApp from cache (default: false). ``` -------------------------------- ### Host(id: String, subscriptionKey: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-host Constructor for creating a new Host instance. ```APIDOC ## Host Constructor ### Description Creates a new instance of the Host class with the specified ID and subscription key. ### Signature `Host(id: String, subscriptionKey: String)` ### Parameters - **id** (String) - The host ID information of the mini app. - **subscriptionKey** (String) - The subscription identifier of the mini app. ``` -------------------------------- ### MiniAppView.load Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Loads a mini app with specified query parameters. ```APIDOC ## MiniAppView.load(queryParams: String, callback: (MiniAppDisplay, MiniAppException?) -> Unit) ### Description Loads the mini app into the view with the provided query parameters appended to the URL. ### Parameters - **queryParams** (String) - Required - Query parameters to append to the mini app URL. - **callback** (Function) - Required - A callback function that receives the display object and an optional exception. ``` -------------------------------- ### MiniAppFileDownloaderDefault(Activity, Int) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.file/-mini-app-file-downloader-default/-mini-app-file-downloader-default.html Constructor for initializing the MiniAppFileDownloaderDefault with an activity and a request code for file downloading operations. ```APIDOC ## MiniAppFileDownloaderDefault(Activity, Int) ### Description Initializes a new instance of the MiniAppFileDownloaderDefault class. This is used to handle file downloading via an intent within the SDK. ### Parameters - **activity** (Activity) - The activity context used for file downloading. - **requestCode** (Int) - The request code used for the file downloading intent, which is also used to retrieve the file Uri via Activity.onActivityResult in the HostApp. ``` -------------------------------- ### InfoParams Constructor Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-parameters/-info-params Constructor for initializing InfoParams with context, configuration, mini app info, and cache settings. ```APIDOC ## InfoParams(context: Context, config: MiniAppConfig, miniAppInfo: MiniAppInfo, fromCache: Boolean) ### Description Initializes a new instance of InfoParams to be used in the HostApp for creating mini app views. ### Parameters - **context** (Context) - Required - The activity context used for initializing internal services. - **config** (MiniAppConfig) - Required - Configuration for the independent MiniApp. - **miniAppInfo** (MiniAppInfo) - Required - Metadata of the mini app. - **fromCache** (Boolean) - Optional (default: false) - Flag to allow loading the mini app from cache. ``` -------------------------------- ### PreviewMiniAppInfo Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-preview-mini-app-info The PreviewMiniAppInfo class holds information about the host and the MiniApp entity for preview purposes. ```APIDOC ## PreviewMiniAppInfo ### Description A data class that represents a response entity for preview code, implementing Parcelable for Android data passing. ### Constructor `PreviewMiniAppInfo(host: Host, miniapp: MiniAppInfo)` ### Properties - **host** (Host) - The host identifier unique to a mini app. - **miniapp** (MiniAppInfo) - The Mini App entity associated with the preview. ``` -------------------------------- ### val miniAppUrl: String Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-parameters/-url-params/mini-app-url.html Represents the URL of the Mini App to be loaded. ```APIDOC ## Property: miniAppUrl ### Description The `miniAppUrl` property is a String that specifies the URL of the Mini App. It is part of the `MiniAppParameters.UrlParams` configuration used when initializing or loading a Mini App. ### Signature `val miniAppUrl: String` ### Type String ``` -------------------------------- ### MiniApp.instance Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/-companion Retrieves the MiniApp instance, optionally allowing for custom configuration settings. ```APIDOC ## MiniApp.instance ### Description Returns the singleton instance of MiniApp. By default, it uses settings defined in the AndroidManifest.xml, but allows for runtime configuration overrides via MiniAppSdkConfig. ### Signature `fun instance(settings: MiniAppSdkConfig = defaultConfig, setConfigAsDefault: Boolean = true): MiniApp` ### Parameters - **settings** (MiniAppSdkConfig) - Optional - The configuration settings to apply. Defaults to the application's default configuration. - **setConfigAsDefault** (Boolean) - Optional - Determines whether the provided config should be set as the default for future calls. Defaults to true. ``` -------------------------------- ### MiniApp.create Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Creates a MiniAppDisplay instance for a specific mini app ID, handling download and caching logic. ```APIDOC ## MiniApp.create(miniAppId: String, miniAppMessageBridge: MiniAppMessageBridge) ### Description Creates a view for displaying a specific mini app. This method checks for the latest version, downloads it if necessary, and returns a MiniAppDisplay instance. ### Parameters - **miniAppId** (String) - Required - The unique identifier of the mini app. - **miniAppMessageBridge** (MiniAppMessageBridge) - Required - An implementation of the message bridge to handle communication between the host app and the mini app. ### Returns - **MiniAppDisplay** - An instance representing the downloaded mini app. ### Exceptions - **RequiredPermissionsNotGrantedException** - Thrown if required manifest permissions have not been granted via MiniApp.setCustomPermissions. ``` -------------------------------- ### loadFromBundle(manifest: MiniAppManifest?, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-view/load-from-bundle.html Loads a mini app view from a bundle. The mini app is downloaded, saved, and provides a view when successful. ```APIDOC ## loadFromBundle ### Description Loads a mini app view from a bundle. The mini app is downloaded, saved, and provides a view when successful. ### Signature `abstract fun loadFromBundle(manifest: MiniAppManifest? = null, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit)` ### Parameters - **manifest** (MiniAppManifest?) - Optional - The parameters will be appended with the miniapp manifest. - **onComplete** ((MiniAppDisplay?, MiniAppSdkException?) -> Unit) - Required - Callback function invoked when the miniapp is successfully loaded, providing the MiniAppDisplay or a MiniAppSdkException. ``` -------------------------------- ### activity Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.file/-mini-app-file-downloader-default/activity.html Accesses the Activity instance used by the MiniAppFileDownloaderDefault. ```APIDOC ## Property: activity ### Description Returns or sets the Android Activity context associated with the MiniAppFileDownloaderDefault instance. ### Type android.app.Activity ``` -------------------------------- ### MiniAppNavigator Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Interface for handling external URL navigation and file downloads within the host application. ```APIDOC ## MiniAppNavigator ### Description Implement this interface to control how external URLs are opened and how file downloads are handled within the MiniApp. ### Methods - **openExternalUrl(url: String, externalResultHandler: ExternalResultHandler)**: Invoked when the MiniApp attempts to open an external URL. Use this to load the URL in a custom WebView or browser. ### File Downloads To handle file downloads, implement the `MiniAppDownloadNavigator` interface alongside `MiniAppNavigator`: - **onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long)**: Invoked when a file download is triggered via XHR. The URL provided is a Base64 data URI. ``` -------------------------------- ### Retrieve Mini App Manifest in Host App Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Use the MiniApp SDK to fetch manifest details asynchronously, including localized permission descriptions. ```kotlin CoroutineScope(Dispatchers.IO).launch { try { val miniAppManifest = MiniApp.instance().getMiniAppManifest( appId = "MINI_APP_ID", versionId = "VERSION_ID", languageCode = "ja" ) // Host App can set it's own metadata key in manifest.json to retrieve the value miniAppManifest.customMetaData["hostAppRandomTestKey"] } catch(e: MiniAppSdkException) { Log.e("MiniApp", "There was an error when retrieving the Mini App manifest", e) } } ``` -------------------------------- ### listDownloadedWithCustomPermissions Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/list-downloaded-with-custom-permissions.html Retrieves a list of downloaded mini applications and their custom permissions. ```APIDOC ## listDownloadedWithCustomPermissions ### Description Lists out the mini applications available with custom permissions in the cache. ### Signature `abstract fun listDownloadedWithCustomPermissions(): List>` ### Returns - **List>** - A list of mini applications that are downloaded and contain custom permissions data. ``` -------------------------------- ### val host: Host Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-preview-mini-app-info/host.html Retrieves the Host object associated with the preview mini app information. ```APIDOC ## val host: Host ### Description Returns the host configuration associated with the preview mini app. This property is serialized from the "host" field. ### Type Host ``` -------------------------------- ### Implement Custom Ad Displayer Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Implement the MiniAppAdDisplayer interface to take manual control over ad loading and display. ```kotlin class CustomAdDisplayer: MiniAppAdDisplayer { override fun loadInterstitialAd(adUnitId: String, onLoaded: () -> Unit, onFailed: (String) -> Unit) { // load the ad } override fun showInterstitialAd(adUnitId: String, onClosed: () -> Unit, onFailed: (String) -> Unit) { // show the ad } //...more ad implementations. } miniAppMessageBridge.setAdMobDisplayer(CustomAdDisplayer()) ``` -------------------------------- ### Version(versionTag: String, versionId: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-version/-version.html Initializes a new instance of the Version class with the specified version tag and version ID. ```APIDOC ## Version(versionTag: String, versionId: String) ### Description Creates a new instance of the Version class to represent a specific version of a MiniApp. ### Parameters - **versionTag** (String) - The tag associated with the version. - **versionId** (String) - The unique identifier for the version. ``` -------------------------------- ### MiniApp.instance(settings: MiniAppSdkConfig, setConfigAsDefault: Boolean) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/-companion/instance.html Retrieves the MiniApp instance. Uses default configuration from AndroidManifest.xml unless a custom MiniAppSdkConfig is provided. ```APIDOC ## MiniApp.instance ### Description Returns the MiniApp instance. This method is used to initialize or retrieve the SDK instance. It supports optional configuration overrides for runtime customization. ### Signature `fun instance(settings: MiniAppSdkConfig = defaultConfig, setConfigAsDefault: Boolean = true): MiniApp` ### Parameters - **settings** (MiniAppSdkConfig) - Optional - The configuration settings to use. Defaults to `defaultConfig`. - **setConfigAsDefault** (Boolean) - Optional - Whether to set the provided config as the default for future calls. Defaults to `true`. ### Returns - **MiniApp** - The initialized MiniApp instance. ``` -------------------------------- ### MiniAppAnalyticsConfig(acc: Int, aid: Int) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.analytics/-mini-app-analytics-config Constructor for creating a new instance of MiniAppAnalyticsConfig with the required analytics credentials. ```APIDOC ## MiniAppAnalyticsConfig(acc: Int, aid: Int) ### Description Initializes a new configuration object for analytics, requiring the RAT account ID and RAT app ID. ### Parameters - **acc** (Int) - The RAT account id. - **aid** (Int) - The RAT app id. ``` -------------------------------- ### load Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-view Loads a MiniApp view. The MiniApp is downloaded, saved, and provides a view upon success. ```APIDOC ## load ### Description Loads a mini app view. The mini app is downloaded, saved and provides a view when successful. ### Signature `abstract fun load(queryParams: String = "", fromCache: Boolean = false, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit)` ### Parameters - **queryParams** (String) - Optional - Query parameters to pass to the MiniApp. - **fromCache** (Boolean) - Optional - Whether to load the MiniApp from cache. - **onComplete** (Function) - Required - Callback invoked with the MiniAppDisplay or MiniAppSdkException. ``` -------------------------------- ### List Downloaded Mini Apps with Permissions Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Retrieve a list of downloaded Mini Apps along with their associated custom permissions. ```kotlin val downloadedMiniApps = miniapp.listDownloadedWithCustomPermissions() downloadedMiniApps.forEach { val miniApp = it.first val permissions = it.second // Display permissions in view, etc.... } ``` -------------------------------- ### HostAppThemeColors(primaryColor: String?, secondaryColor: String?) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.js.hostenvironment/-host-app-theme-colors Constructor for the HostAppThemeColors data class. ```APIDOC ## HostAppThemeColors ### Description Represents the color theme of the host app. ### Constructor `HostAppThemeColors(primaryColor: String?, secondaryColor: String?)` ### Properties - **primaryColor** (String?) - The primary color of the host app. - **secondaryColor** (String?) - The secondary color of the host app. ``` -------------------------------- ### Mini App Manifest Configuration Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Define required and optional permissions along with custom metadata in the manifest.json file. ```json { "reqPermissions":[ { "name":"rakuten.miniapp.user.USER_NAME", "reason":"Describe your reason here." }, { "name":"rakuten.miniapp.user.PROFILE_PHOTO", "reason":"Describe your reason here." } ], "optPermissions":[ { "name":"rakuten.miniapp.user.CONTACT_LIST", "reason":"Describe your reason here." }, { "name":"rakuten.miniapp.device.LOCATION", "reason":"Describe your reason here." } ], "customMetaData":{ "hostAppRandomTestKey":"metadata value" } } ``` -------------------------------- ### Implement MiniAppDownloadNavigator for file downloads Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Extend the navigator to intercept file download requests, which are provided as Base64 data URIs. ```kotlin miniAppNavigator = object : MiniAppNavigator, MiniAppDownloadNavigator { // Override MiniAppNavigator functions here // ... // Override MiniAppDownloadNavigator functions fun onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long) { // Decode URL as Base 64 and then use it somehow - i.e. save to device, share to another App, etc. } } ``` -------------------------------- ### Initialize MiniAppExternalUrlLoader for automatic checks Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Create an instance of the loader to facilitate automatic URL checking when using a separate Activity for the external WebView. ```kotlin val miniAppExternalUrlLoader = MiniAppExternalUrlLoader(miniAppId, externalWebViewActivity) ``` -------------------------------- ### listMiniApp() Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/list-mini-app.html Fetches and lists out the mini applications available in the MiniApp Ecosystem. ```APIDOC ## listMiniApp ### Description Fetches and lists out the mini applications available in the MiniApp Ecosystem. ### Signature `abstract suspend fun listMiniApp(): List` ### Returns - **List** - A list of mini application information objects when the operation is successful. ### Throws - **com.rakuten.tech.mobile.miniapp.MiniAppSdkException** - Thrown when fetching fails from the backend server for any reason. ``` -------------------------------- ### getMiniAppManifest(appId: String, versionId: String, languageCode: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/get-mini-app-manifest.html Retrieves the manifest information for a given mini app, including permissions. ```APIDOC ## getMiniAppManifest ### Description Retrieves the manifest information, such as required and optional permissions, for a specific mini app version. ### Signature `abstract suspend fun getMiniAppManifest(appId: String, versionId: String, languageCode: String = ""): MiniAppManifest` ### Parameters - **appId** (String) - Required - The unique identifier of the mini app. - **versionId** (String) - Required - The version identifier of the mini app. - **languageCode** (String) - Optional - The language code for the mini app manifest. ### Returns - **MiniAppManifest** - An object containing the manifest information of the mini app. ``` -------------------------------- ### fetchInfo(appId: String) Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp/-mini-app/fetch-info.html Fetches meta data information of a mini app. ```APIDOC ## fetchInfo(appId: String) ### Description Fetches meta data information of a mini app. ### Signature `abstract suspend fun fetchInfo(appId: String): MiniAppInfo` ### Parameters - **appId** (String) - Required - The unique identifier of the mini app. ### Returns - **MiniAppInfo** - The metadata information for the provided appId. ### Throws - **MiniAppNotFoundException** - Thrown when the specified project ID does not have any mini app exist on the server. - **MiniAppHasNoPublishedVersionException** - Thrown when the specified mini app ID exists on the server but has no published versions. - **MiniAppSdkException** - Thrown when fetching fails from the backend server for any other reason. ``` -------------------------------- ### MiniAppMessageBridge.getHostEnvironmentInfo Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Provides host environment information to the mini app. ```APIDOC ## MiniAppMessageBridge.getHostEnvironmentInfo ### Description Returns a HostEnvironmentInfo object containing details about the host environment to the mini app. ``` -------------------------------- ### loadFromBundle Source: https://rakutentech.github.io/android-miniapp/docs/5.7/api/miniapp/com.rakuten.tech.mobile.miniapp.view/-mini-app-view Loads a MiniApp view from a local bundle. ```APIDOC ## loadFromBundle ### Description Load a mini app view from bundle. The mini app is downloaded, saved and provides a view when successful. ### Signature `abstract fun loadFromBundle(manifest: MiniAppManifest? = null, onComplete: (MiniAppDisplay?, MiniAppSdkException?) -> Unit)` ### Parameters - **manifest** (MiniAppManifest?) - Optional - The manifest associated with the bundle. - **onComplete** (Function) - Required - Callback invoked with the MiniAppDisplay or MiniAppSdkException. ``` -------------------------------- ### Add Mini App SDK dependency Source: https://rakutentech.github.io/android-miniapp/docs/5.6 Include the SDK in your project's build.gradle file by adding the repository and the implementation dependency. ```gradle repositories { mavenCentral() } dependency { implementation 'io.github.rakutentech.miniapp:miniapp:${version}' } ```