App Installation via App ID in Android Sandbox
We've provided a new API that allows you to install apps directly in the Android Sandbox using your App ID without manually downloading and installing them (https://docs.lybic.cn/en/sandbox/android/install-apk/).
This method is faster and more efficient than traditional APK installation, and is particularly suitable for testing scenarios that require frequent app installation and uninstallation.
curl -X PUT "https://api.Lybic.cn/api/orgs/{orgId}/sandboxes/{sandboxId}/apps/{app_id}" -H "Authorization: Bearer YOUR_API_KEY"This interface requires Python SDK (lybic) version >= 1.4.0 to use the install_sandbox_application method:
method: install_sandbox_application(sandbox_id: str, app_id: str)
- args:
- sandbox_id: str ID of the sandbox
- app_id: str ID of the application to install
- return:
SandboxApplicationInstallAcceptedDtocontainingoperationIdand initialstatus
import asyncio
from lybic import LybicClient, LybicAuth
async def install_sandbox_app_example():
async with LybicClient(
LybicAuth(
org_id="ORG-xxxx",
api_key="lysk-xxxxxxxxxxx"
)
) as client:
result = await client.tools.mobile_use.install_sandbox_application(
sandbox_id="SBX-xxxx",
app_id="APP-xxxx"
)
print(f"Operation ID: {result.operationId}")
print(f"Initial status: {result.status}")
if __name__ == '__main__':
asyncio.run(install_sandbox_app_example())You can check the application installation status until it is complete:
curl -X GET "https://api.Lybic.cn/api/orgs/{orgId}/sandboxes/{sandboxId}/operations/{operation_id}" -H "Authorization: Bearer YOUR_API_KEY"This interface requires Python SDK (lybic) version >= 1.4.0 to use the get_sandbox_application_operation method:
import asyncio
from lybic import LybicClient, LybicAuth
async def poll_install_operation_example():
async with LybicClient(
LybicAuth(
org_id="ORG-xxxx",
api_key="lysk-xxxxxxxxxxx",
endpoint="https://api.lybic.cn/"
)
) as client:
# Start installation
accepted = await client.tools.mobile_use.install_sandbox_application(
sandbox_id="SBX-xxxx",
app_id="APP-xxxx"
)
print(f"Installation started, operation ID: {accepted.operationId}")
# Poll until the operation completes
while True:
operation = await client.tools.mobile_use.get_sandbox_application_operation(
sandbox_id="SBX-xxxx",
operation_id=accepted.operationId
)
print(f"Status: {operation.status}")
if operation.status in ("SUCCEEDED", "FAILED", "CANCELLED"):
print(f"Final status: {operation.status}, detail: {operation.detail}")
break
await asyncio.sleep(5)
if __name__ == '__main__':
asyncio.run(poll_install_operation_example())Note: How to Obtain an App ID Before using the Install App via App ID feature, you must first obtain the corresponding App ID for the application. App IDs are centrally managed by the Lybic platform, and each application is assigned a unique App ID.
Please send the list of applications you want to install to lybic@tingyutech.com. We will generate the corresponding App ID mapping and return it to you for use in API calls.