Skip to content

fix. launchApp function#1249

Merged
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main
Apr 10, 2025
Merged

fix. launchApp function#1249
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main

Conversation

@RohitKushvaha01
Copy link
Member

The previously used method of launching apps via getLaunchIntentForPackage() is very limited and often doesn't work due to privacy restrictions in Android 11 and above. This PR fixes the issue by explicitly providing the activity class name to the intent. It also sends a string extra if provided. The target app should be aware of this, allowing plugins to send data to supported apps.

this is the new signature

/**
   * Launches and app
   * @param app the package name of the app
   * @param className the full class name of the activity
   * @param data Data to pass to the app
   * @param onSuccess
   * @param onFail
   */
  launchApp(
    app: string,
    className: string,
    data: string,
    onSuccess: OnSuccessBool,
    onFail: OnFail,
  ): void;

Example Uses:

system.launchApp(
  "com.example.targetapp",                 // app package name
  "com.example.targetapp.MainActivity",    // full activity class name
  "some string data to send",              // optional string data
  (success) => {
   console.log("App launched successfully!");
  },
  (error) => {
    console.error("Failed to launch app:", error);
  }
);

@bajrangCoder bajrangCoder requested a review from Copilot April 10, 2025 09:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • www/index.html: Language not supported

@bajrangCoder bajrangCoder merged commit 906f220 into Acode-Foundation:main Apr 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants