Get started with the GBOX SDK to create and manage virtual devices
npm install gbox-sdk
import GboxSDK from "gbox-sdk"; const gboxSDK = new GboxSDK({ apiKey: process.env["GBOX_API_KEY"], // Recommended: use environment variables });
async function createAndroidBox() { try { const box = await gboxSDK.create({ type: "android", // Optional: add other configuration parameters }); console.log("Android device created successfully:", box.id); return box; } catch (error) { console.error("Failed to create Android device:", error); } } createAndroidBox();
import GboxSDK from "gbox-sdk"; const gboxSDK = new GboxSDK({ apiKey: process.env["GBOX_API_KEY"], }); async function main() { try { // Create an Android device const box = await gboxSDK.create({ type: "android" }); console.log(`Device created successfully, ID: ${box.id}`); // Start the device await gboxSDK.startBox({ id: box.id }); console.log("Device started successfully"); // Wait for device to be ready... // Stop the device await gboxSDK.stopBox({ id: box.id }); console.log("Device stopped"); } catch (error) { console.error("Operation failed:", error); } } main();
Was this page helpful?