---
title: "Scanning via Intent"
slug: "scanning-via-intent-4"
updated: 2024-09-05T12:55:00Z
published: 2024-09-05T12:55:00Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.vuzix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scanning via Intent

The simplest way to integrate barcode scanning into your app is to invoke the Barcode Scanner via an intent.

```java
import com.vuzix.sdk.barcode.ScannerIntent;
import com.vuzix.sdk.barcode.ScanResult2;
private static final int REQUEST_CODE_SCAN = 0;
Intent scannerIntent = new Intent(ScannerIntent.ACTION);
startActivityForResult(scannerIntent, REQUEST_CODE_SCAN);
```

The scan result will be returned to you in onActivityResult():

```java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	switch (requestCode) {
		case REQUEST_CODE_SCAN: if (resultCode == Activity.RESULT_OK) { 
				ScanResult2 scanResult = data.getParcelableExtra(ScannerIntent.RESULT_EXTRA_SCAN_RESULT2);
				// do something with scan result
			} return;
	}
	super.onActivityResult(requestCode, resultCode, data);
}
```

For more information on barcode scanning by intent, including intent extras that are available, refer to the [JavaDoc](https://vuzix.github.io/sdk-speechrecognitionservice/javadoc/reference/classes.html) for the ScannerIntent class.

A sample Android Studio project demonstrating barcode scanning via intent is available on our [Github](https://github.com/vuzix?q=M300&amp;type=all&amp;language=&amp;sort=).
