MCPcopy Index your code
hub / github.com/callstack/agent-device / openAndroidApp

Function openAndroidApp

src/platforms/android/app-lifecycle.ts:323–353  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  app: string,
  optionsOrActivity?: OpenAndroidAppOptions | string,
)

Source from the content-addressed store, hash-verified

321}
322
323export async function openAndroidApp(
324 device: DeviceInfo,
325 app: string,
326 optionsOrActivity?: OpenAndroidAppOptions | string,
327): Promise<void> {
328 if (!device.booted) {
329 await waitForAndroidBoot(device.id);
330 }
331 const options = normalizeOpenAndroidAppOptions(optionsOrActivity);
332 const activity = options.activity;
333 const deepLinkTarget = app.trim();
334 if (isDeepLinkTarget(deepLinkTarget)) {
335 await openAndroidDeepLink(device, deepLinkTarget, options);
336 return;
337 }
338 if (options.url !== undefined) {
339 await openAndroidAppBoundDeepLink(device, app, options);
340 return;
341 }
342 const resolved = await resolveAndroidApp(device, app);
343 const launchCategory = resolveAndroidLauncherCategory(device);
344 if (resolved.type === 'intent') {
345 await openAndroidIntent(device, resolved.value, options);
346 return;
347 }
348 if (activity) {
349 await openAndroidPackageActivity(device, resolved.value, activity, launchCategory, options);
350 return;
351 }
352 await openAndroidPackage(device, resolved.value, launchCategory, options);
353}
354
355async function openAndroidDeepLink(
356 device: DeviceInfo,

Calls 10

waitForAndroidBootFunction · 0.90
isDeepLinkTargetFunction · 0.90
openAndroidDeepLinkFunction · 0.85
resolveAndroidAppFunction · 0.85
openAndroidIntentFunction · 0.85
openAndroidPackageFunction · 0.85

Tested by

no test coverage detected