Boxo SDK
iOS SDK
Compatibility
Your project must target iOS 10 or later. Swift projects should use Swift 4.2 or later, and CocoaPods 1.8.1 or later is required.
Swift Package Manager installation
Add a package by selecting File → Add Packages… in Xcode’s menu bar.
Search for the BoxoSDK using the repo’s URL:
https://github.com/Appboxo/appboxo-ios-spm.git
Next, set the Dependency Rule to be Up to Next Major Version.
Then, select Add Package.
CocoaPods installation
Using CocoaPods to create a Podfile if you don’t already have one.
Add the Boxo pod to your Podfile
Install the pods, then open your .xcworkspace file to see the project in Xcode:
Add Usage Descriptions (optional)
-
Add Camera Usage Description in info.plist
To use camera functionality, you must provide a usage description in your Info.plist. Please add the Privacy - Camera Usage Description (NSCameraUsageDescription) key along with a brief explanation of why your app requires camera access.
-
Add Privacy - Location When In Use Usage Description in info.plist
To use location functionality, please add the Privacy - Location When In Use Usage Description (NSLocationWhenInUseUsageDescription) key to your Info.plist file. Provide a brief explanation for why your app requires access to location data.
-
Add Privacy - Microphone Usage Description in info.plist
To use the microphone, you must provide a rationale for its use. Please add the Privacy - Microphone Usage Description (NSMicrophoneUsageDescription) key to your Info.plist file with a brief explanation of why your app requires access to the microphone.
Launch miniapp
Import Boxo SDK in your ViewController:
Initialize Boxo in your app by configuring a Boxo shared instance. Remember to replace client_id
field with your desired client_id
.
To launch the miniapp, you will need a UIViewController:
UIKit
To open miniapp write this code in your UIViewController:
SwiftUI
If you are using SwiftUI, you need to access the current UIViewController. There are many ways to obtain a UIViewController. Here is one of them:
Miniapp lifecycle events
Miniapp lifecycle events allow you to monitor key activities, such as onLaunch
, onResume
, onPause
, onClose
, and onError
. These events help track the miniapp’s behavior throughout its usage lifecycle.
Dark mode
Dark mode support for splash screen and other native components used inside miniapp.
Use MiniappConfig to override theme of miniapp.
Auth flow
Setup onAuth listener for login event from Miniapp
Logout to clear mininapp data
When host app user logs out, it is highly important to clear all miniapp storage data. To clear call .logout()
:
Miniapp URL listener
To listen for any URL change events, use .setUrlChangeListener:
Append custom params to miniapp URL
To append custom data params to miniapp URL use .params:
Custom action menu item
You can add your custom action menu item to existing default action menu item by defining .setCustomActionMenuItemImage
To show/hide custom action menu item use miniapp.showCustomActionMenuItem()
and miniapp.hideCustomActionMenuItem()
Get list of miniapps
Consent Management
To skip miniapp splash screen
Sandbox mode
sandboxMode: it should open miniapps in “Approved” and “InTesting” statuses List of miniapps returns:
- when true, miniapps in “Approved” and “InTesting” statuses
- when false, miniapps only in “Approved” status
Page Animation Configuration
Customize the animation effects to enhance the user experience by setting the appropriate page transition animation when opening a miniapp.
You can choose from the following page animations:
LEFT_TO_RIGHT
- The miniapp slides in from the left side of the screen to the right.RIGHT_TO_LEFT
- The miniapp slides in from the right side of the screen to the left.BOTTOM_TO_TOP
- The miniapp slides in from the bottom of the screen to the top.TOP_TO_BOTTOM
- The miniapp slides in from the top of the screen to the bottom.FADE_IN
- The miniapp fades in gradually from completely transparent to opaque.
The BOTTOM_TO_TOP
animation is the default page transition effect. You can easily change the animation to any of the other available options based on the user experience you want to provide.
SDK size
- BoxoSDK - 5.9 MB
Android SDK
Please see our sample Android app to learn more.
Compatibility
Your project must target at least Android 5.0 (API level 21) or higher.
Installation
Latest version: Link
To install Boxo SDK, add com.appboxo:sdk
to the dependencies
block of your app/build.gradle file:
Add it in your settings.gradle.kts at the end of repositories:
Add this line to root gradle.properties:
Launch miniapp
-
Add to your existing
Application
class or create a new one if you don’t have anApplication
class yet.MyApplication.kt -
Then register it in AndroidManifest.xml:
-
Open miniapp
SDK Configurations
Configure BoxoSDK with these settings to customize behavior, language, and UI elements.
Language Configuration
Use it to provide language to miniapp. Default: ‘en’
System Behavior
Parameter | Type | Description | Default |
---|---|---|---|
multitaskMode | Boolean | Shows Miniapps in Android Recents screen when true | false |
debug | Boolean | Enables WebView debugging (Chrome DevTools) | false |
Miniapp Menu Customization
Parameter | Description | Default |
---|---|---|
permissionsPage | Setting menu item | true |
showClearCache | Clear Cache menu item | true |
showAboutPage | About Miniapp menu item | true |
Sandbox Mode Configuration
Control which miniapps are available in your development environment using the sandbox mode flag:
Behavior: Retrieve Miniapp List will return miniapps with the statuses listed below.
Sandbox Mode | Available Miniapp Statuses | Use Case |
---|---|---|
true | Approved + InTesting | Development environment - access to miniapps still in testing |
false | Approved only | Production environment - only fully approved miniapps |
Theme Configuration
Configure native component theming to match your app’s design system or respect user preferences. The SDK provides comprehensive theme support for:
- Splash screens
- Native UI components
- System dialogs and alerts
Theme Options:
Option | Description |
---|---|
SYSTEM | Automatically matches device theme |
LIGHT | Forces light theme |
DARK | Forces dark theme |
Control theme behavior at both global and per-miniapp levels for maximum flexibility.
Global Theme (Affects all miniapps)
Per-Miniapp Theme Override
Miniapp Auth Flow
Handle authentication between your host app and miniapps:
User Logout & Data Clearing
When users log out of your host app, you must completely clear all miniapp session data
Miniapp URL Change Listener
To listen for any URL change events use .setUrlChangeListener:
Custom URL Parameters
Append additional query parameters to miniapp’s initial URL for passing contextual data. This enables:
- User-specific data injection
- Campaign tracking
- Contextual deep linking
- A/B testing configuration
Basic Implementation
Parameters will be automatically URL-encoded and appended as query parameters:
Custom Event Handling
Establish two-way communication between your hostapp and miniapps using custom events. This system enables:
- Real-time data exchange
- User interaction tracking
- Miniapp to host app callbacks
- Dynamic content updates
Adding Custom Action Menu
You can extend the miniapp’s native menu by adding your own custom action item. This is achieved through two simple steps:
- Define the Menu Item
Use.setCustomActionMenuItem()
to specify your custom button’s appearance - Handle User Interactions
Implement.setCustomActionMenuItemClickListener()
to respond when users tap your button
Control Visibility:
Retrieve Miniapp List
Fetch the complete catalog of available miniapps with detailed metadata. This asynchronous operation returns:
- Basic miniapp information (id, name, description)
- Logo
- Category
Splash Screen Configuration
Control the miniapp loading experience by customizing splash screen behavior. By default, miniapps display a splash screen that automatically hides when 50% of web content has loaded.
Page Animation Configuration
Important: Animations will only work if multitaskMode
is set tofalse
. Make sure to configure it accordingly to enable page transition animations.
Customize the animation effects to enhance the user experience by setting the appropriate page transition animation when opening a miniapp.
You can choose from the following page animations:
LEFT_TO_RIGHT
- The miniapp slides in from the left side of the screen to the right.RIGHT_TO_LEFT
- The miniapp slides in from the right side of the screen to the left.BOTTOM_TO_TOP
- The miniapp slides in from the bottom of the screen to the top.TOP_TO_BOTTOM
- The miniapp slides in from the top of the screen to the bottom.FADE_IN
- The miniapp fades in gradually from completely transparent to opaque.
The BOTTOM_TO_TOP
animation is the default page transition effect. You can easily change the animation to any of the other available options based on the user experience you want to provide.
Miniapp Lifecycle Events
Track key moments in a miniapp’s execution by implementing the LifecycleListener
. These events help you monitor user interactions and manage app state transitions.
Flutter SDK
A Flutter plugin to integrate Boxo for iOS and Android. Please see our sample Flutter app to learn more.
Installation
Run this command: With Flutter:
This will add a line like this to your package’s pubspec.yaml (and run an implicit flutter pub get
):
dependencies: appboxo_sdk: ^0.7.0
Add this line to android/gradle.properties
Launch Miniapp
Set Config
Sandbox mode
sandboxMode: it should open miniapps in “Approved” and “InTesting” statuses List of miniapps returns:
- when true, miniapps in “Approved” and “InTesting” statuses
- when false, miniapps only in “Approved” status
Get list of miniapps
To listen miniapp lifecycle events:
React Native SDK
A react native wrapper over Boxo SDK for IOS and Android.
Installation
or
Please make sure the “@appboxo/react-native-sdk” dependency is linked, if not please run:
Add this line to android/gradle.properties
Next for IOS:
Launch Miniapp
Usage:
Miniapp lifecycle events
Important Miniapp lifecycle events available in 1.0.8+ versions
Append custom params to miniapp URL
Important Custom params available in 1.0.26+ versions
To append any custom data as URL param to miniapp’s URL use extraUrlParams:
Sandbox mode
sandboxMode: it should open miniapps in “Approved” and “InTesting” statuses List of miniapps returns:
- when true, miniapps in “Approved” and “InTesting” statuses
- when false, miniapps only in “Approved” status
Get list of miniapps
Capacitor
Installation
Launch Miniapp
Example:
Set Config
Config Options
Prop | Type | Description |
---|---|---|
clientId | string | your client id from dashboard |
userId | string | (optional) hostapp userId, will be used for the Consent Management |
language | string | language value will be passed to the miniapp |
sandboxMode | boolean | switch to sandbox mode |
enableMultitaskMode | boolean | (Android only) Each miniapp appears as a task in the Recents screen. |
theme | ’light’ | ‘dark’ | ‘system’ | theme for splash screen and other native components used inside miniapp. |
isDebug | boolean | enables webview debugging |
showPermissionsPage | boolean | use it to hide “Settings” from Miniapp menu |
showClearCache | boolean | use it to hide “Clear cache” from Miniapp menu |
showAboutPage | boolean | use it to hide “About Page” from Miniapp menu |
miniappSettingsExpirationTime | number | use it to change miniapp settings cache time in sec. Default: 60 sec |
Miniapp Control
Open
Open miniapp with options
OpenMiniappOptions
Prop | Type | Description |
---|---|---|
appId | string | miniapp id |
data | object | (optional) data as Map that is sent to miniapp |
theme | ’light’ | ‘dark’ | ‘system’ | (optional) miniapp theme “dark” | “light” (by default is system theme) |
extraUrlParams | object | (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
urlSuffix | string | (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
colors | ColorOptions | (optional) provide colors to miniapp if miniapp supports |
enableSplash | boolean | (optional) use to skip miniapp splash screen |
saveState | boolean | (optional) use to save state on close miniapp |
ColorOptions
Prop | Type |
---|---|
primaryColor | string |
secondaryColor | string |
tertiaryColor | string |
Close
close miniapp by appId
Hide
Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen. To use this function need to enable ‘enableMultitaskMode: true’ in Appboxo.setConfigs()
Miniapp Auth Flow
Handle authentication between your host app and miniapps:
User Logout & Data Clearing
When users log out of your host app, you must completely clear all miniapp session data
Retrieve Miniapp List
Get list of miniapps
MiniappListResult
Prop | Type |
---|---|
miniapps | [MiniappData] |
error | string |
MiniappData
Prop | Type |
---|---|
appId | string |
name | string |
category | string |
description | string |
logo | string |
Miniapp Custom Events
When host app user logs out, it is highly important to clear all miniapp storage data.
Param | Type |
---|---|
eventName | ’custom_event’ |
listenerFunc | (customEvent: CustomEvent) => void |
send custom event data to miniapp
Prop | Type |
---|---|
appId | string |
requestId | number |
type | string |
errorType | string |
payload | object |
Miniapp Payment Events
Param | Type |
---|---|
eventName | ’payment_event’ |
listenerFunc | (paymentEvent: PaymentEvent) => void |
send payment data to miniapp
Prop | Type |
---|---|
appId | string |
transactionToken | string |
miniappOrderId | string |
amount | number |
currency | string |
status | string |
hostappOrderId | string |
extraParams | object |
Miniapp Lifecycle Events
Param | Type |
---|---|
eventName | ’miniapp_lifecycle’ |
listenerFunc | (lifecycle: LifecycleEvent) => void |
LifecycleEvent
Prop | Type |
---|---|
appId | string |
lifecycle | string |
error | string |
onLaunch - Called when the miniapp will launch with Appboxo.open(…) onResume - Called when the miniapp will start interacting with the user onPause - Called when the miniapp loses foreground state onClose - Called when clicked close button in miniapp or when destroyed miniapp page onError - Called when miniapp fails to launch due to internet connection issues onUserInteraction - Called whenever touch event is dispatched to the miniapp page. onAuth - Called when the miniapp starts login and user allows it
Expo
Expo plugin to integrate Boxo for iOS and Android. Please see our sample Expo app to learn more.
Installation
Configuration in app.json/app.config.js
Launch Miniapp
Set Config
ConfigOptions
Prop | Type | Description |
---|---|---|
clientId | string | your client id from dashboard |
userId | string | (optional) hostapp userId, will be used for the Consent Management |
language | string | language value will be passed to the miniapp |
sandboxMode | boolean | switch to sandbox mode |
enableMultitaskMode | boolean | (Android only) Each miniapp appears as a task in the Recents screen. |
theme | ’light’ | ‘dark’ | ‘system’ | theme for splash screen and other native components used inside miniapp. |
isDebug | boolean | enables webview debugging |
showPermissionsPage | boolean | use it to hide “Settings” from Miniapp menu |
showClearCache | boolean | use it to hide “Clear cache” from Miniapp menu |
showAboutPage | boolean | use it to hide “About Page” from Miniapp menu |
miniappSettingsExpirationTime | number | use it to change miniapp settings cache time in sec. Default: 60 sec |
Miniapp Control
Open
Open miniapp with options
MiniappOptions
Prop | Type | Description |
---|---|---|
appId | string | miniapp id |
data | object | (optional) data as Map that is sent to miniapp |
theme | ’light’ | ‘dark’ | ‘system’ | (optional) miniapp theme “dark” | “light” (by default is system theme) |
extraUrlParams | object | (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
urlSuffix | string | (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
colors | ColorOptions | (optional) provide colors to miniapp if miniapp supports |
enableSplash | boolean | (optional) use to skip miniapp splash screen |
saveState | boolean | (optional) use to save state on close miniapp |
ColorOptions
Prop | Type |
---|---|
primaryColor | string |
secondaryColor | string |
tertiaryColor | string |
Close
close miniapp by appId
Hide
Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen. To use this function need to enable ‘enableMultitaskMode: true’ in Appboxo.setConfigs()
Miniapp Auth Flow
Handle authentication between your host app and miniapps:
User Logout & Data Clearing
When users log out of your host app, you must completely clear all miniapp session data
Retrieve Miniapp List
Get list of miniapps
MiniappListResult
Prop | Type |
---|---|
miniapps | [MiniappData] |
error | string |
MiniappData
Prop | Type |
---|---|
appId | string |
name | string |
category | string |
description | string |
logo | string |
Miniapp Custom Events
Send custom event data to miniapp
Prop | Type |
---|---|
appId | string |
requestId | number |
type | string |
errorType | string |
payload | object |
Miniapp Payment Events
send payment data to miniapp
Prop | Type |
---|---|
appId | string |
transactionToken | string |
miniappOrderId | string |
amount | number |
currency | string |
status | string |
hostappOrderId | string |
extraParams | object |
Miniapp Lifecycle Events
LifecycleEvent
Prop | Type |
---|---|
appId | string |
lifecycle | string |
error | string |
onLaunch - Called when the miniapp will launch with Appboxo.open(…) onResume - Called when the miniapp will start interacting with the user onPause - Called when the miniapp loses foreground state onClose - Called when clicked close button in miniapp or when destroyed miniapp page onError - Called when miniapp fails to launch due to internet connection issues onUserInteraction - Called whenever touch event is dispatched to the miniapp page. onAuth - Called when the miniapp starts login and user allows it