Skip to content

Instantly share code, notes, and snippets.

@billdawson
Created February 22, 2011 18:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save billdawson/839101 to your computer and use it in GitHub Desktop.
Save billdawson/839101 to your computer and use it in GitHub Desktop.
QR Code Scan Example from Marshall's "Developing Native Android Apps with Titanium" Webinar
qrScanButton.addEventListener("click", function(e) {
var intent = Ti.Android.createIntent({
action: "com.google.zxing.client.android.SCAN"
});
intent.putExtra("SCAN_MODE", "QR_SCAN_MODE");
var activity = Ti.Android.currentActivity;
activity.startActivityForResult(intent, function(e) {
if (e.resultCode == Ti.Android.RESULT_OK) {
var contents = e.intent.getStringExtra("SCAN_RESULT");
var format = e.intent.getStringExtra("SCAN_RESULT_FORMAT");
Ti.UI.createNotification({
message: "Contents: " + contents + ", Format: " + format
}).show();
} else if (e.resultCode == Ti.Android.RESULT_CANCELED) {
Ti.UI.createNotification({
message: "Scan canceled!"
}).show();
}
});
});
@ChinmayPatel
Copy link

What modules are required to run this code? Can you show me the link to the module itself?

@sswathi
Copy link

sswathi commented Feb 1, 2013

i am student i want to develop on barcode would please suggest me or sample source code mail for me
swathi.s896@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment