Handle App Availability
This guide walks you through checking if the Get Mini application is installed on the user's device. You'll learn how to catch the exception when the app is missing and redirect users to the Google Play Store.
Requirements
Before following the steps, ensure you have:
- Android application with Intent launching capability
- Google Play Store access on the device
Important: Always implement this check before attempting to launch payment Intents to provide a better user experience.
App Availability Check
This section guides you through implementing exception handling to detect when the Get Mini app is not installed and guide users to install it.
Step 1: Wrap Intent Launch in Try-Catch
ActivityNotFoundException if the app is not installed. Wrap your Intent launch call in a try-catch block to handle this scenario gracefully.The following code demonstrates how to catch the exception:
Note: This approach works with bothstartActivityForResultand the modernActivityResultLauncherAPI.
Step 2: Show Installation Dialog
When the Get Mini app is not found, display a dialog that explains the situation and provides an option to install the app from the Google Play Store.
Step 3: Handle Return from Play Store (Optional)
After the user returns from the Play Store, you may want to check if they installed the app and retry the transaction. You can implement this by checking app availability when your Activity resumes.
Next Steps
Now that you know how to handle app availability, you can:
- Review Prerequisites and Setup for environment requirements
- Learn about Process a Payment to implement payment transactions
- Read Handle Transaction Results to process Get Mini responses
On this page