Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download app if intent not installed

I know I have seen a way of calling an Intent, and if it doesn't exist the function will redirect to market for download the application that has the intent.

Right now I check if the Intent exists but I don't know how to point the user to the resource to download.

Thanks in advance

like image 397
Roland Avatar asked Nov 21 '10 20:11

Roland


People also ask

What is intent file in Android?

An Intent is a messaging object you can use to request an action from another app component. Although intents facilitate communication between components in several ways, there are three fundamental use cases: Starting an activity. An Activity represents a single screen in an app.

How do I open installed apps on Android?

Swipe up from the bottom of your screen to the top. If you get All Apps , tap it. Tap the app that you want to open.

What are the benefits of intent in Android?

Using intents, you can adjust your app's user experience or ask other apps to perform common actions: taking photos, sending emails and SMS messages, and even displaying locations on maps and playing media. This course teaches you all you need to know to take advantage of this core piece of Android functionality.

How do I send intent from one app to another?

When you construct an intent, you must specify the action you want the intent to perform. Android uses the action ACTION_SEND to send data from one activity to another, even across process boundaries. You need to specify the data and its type.


1 Answers

To check if some Intent is available:

String intentToCheck = "com.google.SCAN"; //can be any other intent
final PackageManager packageManager = getPackageManager();
final Intent intent = new Intent(intentToCheck);
List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
final boolean isAvailable = list.size() > 0;

To open Google Market via Intent:

Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:com.google.scan"));
startActivity(marketIntent); 
like image 192
StanislavK Avatar answered Sep 20 '22 21:09

StanislavK