how to open android application if installed and go to android market if not install

后端 未结 4 1909
滥情空心
滥情空心 2020-12-30 02:48

I would like to make android button and able to launch other application if already installed and go to android market if not yet installed.

How to do this?

4条回答
  •  死守一世寂寞
    2020-12-30 03:47

    Try to call the Application activity from your code using the, other application package name and activity name or by the Intent filters which is belongs to that other application you need to call...

        Intent newIntent;
        newIntent = new Intent("other application Package name","class name");
        startActivity(newIntent);
    

    Check whether it is launched or not.

    //If it is launched, don't do anything

    //If it isn't, then navigate the UI to Google Play Intent.

      Intent googlePlay = new Intent(Intent.ACTION_VIEW);
      googlePlay.setData(Uri.parse("market://details?id="+"other application package name"));
      startActivity(googlePlay);
    

提交回复
热议问题