skip to Main Content

I want to know if its possible to make a button that can launch any app (assuming the user has it installed) with the package name, i dont think its possible but someone out there might know how.

document.location.href = 'intent:#Intent;scheme=app_scheme;package=app_package;end;';

just goes to the google play app showing the app_package app

ive tried one or two other things but there hasnt been anything else that works

2

Answers


  1. yes by using this code

    Button launchButton = findViewById(R.id.launchButton);

    launchButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View view) {
    String packageName = "exampleapp"; // replace with the package name of the target app

        Intent launchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
        if (launchIntent != null) {
            startActivity(launchIntent);
        } else {
            // Handle the case where the target app is not installed
            Toast.makeText(getApplicationContext(), "App not installed", Toast.LENGTH_SHORT).show();
        }
    }
    

    });

    Login or Signup to reply.
  2. It is done via a link, not a package but if you want this should be search inside google play i thing so you can use api for search via package.
    like this

    https://play.google.com/store/search?q=yourpackage

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search