Showing posts from June, 2013

Open Android market (Google Play Store) using Intent

To open google play store (Android market) using intent, just use the code snippet String appName = ""; Uri uri = Uri.parse("market://details?id=" + appName); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (isAvaialable(intent, mContext)) { startActivity(intent); } else { Uri uri = Uri.parse(""+appName); intent.setData(uri); startActivity(intent); } public static boolean isAvailable(Context ctx, Intent intent) { final PackageManager mgr = ctx.getPackageManager(); List list = mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; } isAvailable() is an utility method that I got from

Uniquely Identify a device in Android

For many of the application we may require to uniquely Identify android device. The best way to get the unique device Id is through Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); according to the "android developers blog".