How to Check if Application is Installed in Your Android Phone and Open the App?
In this article, we are going to check if a particular app is installed on our phones or not. If yes then we will be having an option to open the app. Else it will show a toast message saying Not available. So here we are going to learn how to implement that feature. Note that we are going to implement this project using the Java language.
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.
Step 2: Working with the activity_main.xml file
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
Step 3: Working with the MainActivity.java file
Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail.
Step 4: Steps to find the package name of an Android app
We will be requiring the package name of an app to search for the app.
On your PC/Mac:
Step 1: Open https://play.google.com/store in your web browser.
Step 2: Type the name of the app in the search bar to look for the app.
Step 3: Open the app page and look at the URL. The package name forms the end part of the URL i.e. after the id=?. For example for GeeksforGeeks android app it is free.programming.programming.
For Android mobile device:
Step 1: Click on the (share) button.
Step 2: Use it and share the Play Store app link to any service from where you can select and copy text
The app package name is at the end of the app link after id=
Please Login to comment...