Fallback to direct download if Market app isn't installed.

This commit is contained in:
Matt Kane
2010-11-19 09:20:52 +00:00
parent 8117ec5942
commit c47563683c

View File

@@ -153,9 +153,18 @@ public class BarcodeScanner extends Plugin {
public void onClick(DialogInterface dlg, int i) {
dlg.dismiss();
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://search?q=pname:com.google.zxing.client.android")
Uri.parse("market://search?q=pname:com.google.zxing.client.android")
);
context.startActivity(intent);
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
// We don't have the market app installed, so download it directly.
Intent in = new Intent(Intent.ACTION_VIEW);
in.setData(Uri.parse("http://zxing.googlecode.com/files/BarcodeScanner3.5.apk"));
context.startActivity(in);
}
}
});
dialog.setNegativeButton(noString, new DialogInterface.OnClickListener() {