| 1 | package org.openintents.filemanager;\r |
| 2 | \r |
| 3 | import org.openintents.util.IntentUtils;\r |
| 4 | \r |
| 5 | import android.content.Context;\r |
| 6 | import android.content.Intent;\r |
| 7 | import android.net.Uri;\r |
| 8 | \r |
| 9 | /**\r |
| 10 | * @author Peli\r |
| 11 | * @author Karl Ostmo\r |
| 12 | */\r |
| 13 | public class MarketUtils {\r |
| 14 | \r |
| 15 | /**\r |
| 16 | * URI prefix to a package name to bring up the download page on the Android Market\r |
| 17 | */\r |
| 18 | public static final String MARKET_PACKAGE_DETAILS_PREFIX = "market://details?id=";\r |
| 19 | \r |
| 20 | \r |
| 21 | public static boolean isMarketAvailable(Context context, String packageName) {\r |
| 22 | return IntentUtils.isIntentAvailable(context, getMarketDownloadIntent(packageName));\r |
| 23 | }\r |
| 24 | \r |
| 25 | \r |
| 26 | public static Intent getMarketDownloadIntent(String packageName) {\r |
| 27 | Uri marketUri = Uri.parse(MARKET_PACKAGE_DETAILS_PREFIX + packageName);\r |
| 28 | return new Intent(Intent.ACTION_VIEW, marketUri);\r |
| 29 | }\r |
| 30 | }\r |