From 4eb503ee7a8ef3d12c3d6533c4a5346a30a447a2 Mon Sep 17 00:00:00 2001 From: "srowen@gmail.com" Date: Sat, 16 Nov 2013 00:17:24 +0000 Subject: [PATCH] Prefer directing user to Barcode Scanner in preference to anything else, no matter what the list of targeted apps are git-svn-id: https://zxing.googlecode.com/svn/trunk@2909 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../zxing/integration/android/IntentIntegrator.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java b/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java index 3eea8b465..4980e9e7e 100644 --- a/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java +++ b/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java @@ -314,7 +314,14 @@ public class IntentIntegrator { downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - String packageName = targetApplications.get(0); + String packageName; + if (targetApplications.contains(BS_PACKAGE)) { + // Prefer to suggest download of BS if it's anywhere in the list + packageName = BS_PACKAGE; + } else { + // Otherwise, first option: + packageName = targetApplications.get(0); + } Uri uri = Uri.parse("market://details?id=" + packageName); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try {