mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-04-02 03:00:08 -04:00
Fallback to direct download if Market app isn't installed.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user