Social Media Means
Photo by cottonbro studio Pexels Logo Photo: cottonbro studio

How do you scan a team code?

The integration allows web app developers on Teams platform to leverage QR or barcode scanning functionality with Teams JavaScript client SDK. With this feature, the user only needs to align a QR or barcode within a frame at the center of the scanner UI and the code gets scanned automatically.

How to get 1m followers on TikTok for free?
How to get 1m followers on TikTok for free?

4 Steps to Grow to 1 Million Followers on TikTok Choosing a niche. As the saying goes, the riches are in the niches. ... Consistency and cadence....

Read More »
Why don't I have the option to go live on Instagram?
Why don't I have the option to go live on Instagram?

If Instagram doesn't have access to camera, you can't go live streaming. To check if Instagram has access to Camera, you need go to Settings >...

Read More »

Table of contents

Integrate QR or barcode scanner capability

Article

12/14/2022

3 minutes to read

11 contributors Feedback

In this article

Barcode is a method of representing data in a visual and machine-readable form. The barcode contains information about a product, such as a type, size, manufacturer, and Country of origin in the form of bars and spaces. The code is read using the optical scanner on your native device camera. For a richer collaborative experience, you can integrate the QR or barcode scanner capability provided in the Teams platform with your Teams app. You can use Microsoft Teams JavaScript client library, which provides the tools necessary for your app to access the user’s native device capabilities. Use the scanBarCode API to integrate the scanner capability within your app.

Following are the advantages of integration of QR or barcode scanner capabilities:

The integration allows web app developers on Teams platform to leverage QR or barcode scanning functionality with Teams JavaScript client library. With this feature, the user only needs to align a QR or barcode within a frame at the center of the scanner UI and the code gets scanned automatically. The stored data is shared back with the calling web app. This avoids the inconvenience and human errors of entering lengthy product codes or other relevant information manually. To integrate QR or barcode scanner capability, you must update the app manifest file and call the scanBarCode API. For effective integration, you must have a good understanding of code snippet for calling the scanBarCode API, which allows you to use native QR or barcode scanner capability. The API gives an error for an unsupported barcode standard. It's important to familiarize yourself with the API response errors to handle the errors in your Teams app. Note Currently, Microsoft Teams support for QR or barcode scanner capability is only available for mobile clients. Update your Teams app manifest.json file by adding the devicePermissions property and specifying media . It allows your app to ask for requisite permissions from users before they start using the QR or barcode scanner capability. The update for app manifest is as follows:

"devicePermissions": [ "media", ],

How do you know if a post is going viral?
How do you know if a post is going viral?

You know you have a viral Instagram post when it has 100,000+ likes and views and thousands of comments while being posted by an account that has...

Read More »
Why is social media addictive?
Why is social media addictive?

Using social media can lead to physical and psychological addiction because it triggers the brain's reward system to release dopamine, the “feel-...

Read More »

Note The Request Permissions prompt is automatically displayed when a relevant Teams API is initiated. For more information, see Request device permissions.

ScanBarCode API

The scanBarCode API invokes scanner control that enables the user to scan different types of barcode, and returns the result as a string. To customize the barcode scanning experience, optional barcode configuration is passed as input to scanBarCode API. You can specify the scan time-out interval in seconds using timeOutIntervalInSec . Its default value is 30 seconds and the maximum value is 60 seconds.

The scanBarCode() API supports the following barcode types:

Barcode Type Supported on Android Supported on iOS Codebar Yes No Code 39 Yes Yes Code 93 Yes Yes Code 128 Yes Yes EAN-13 Yes Yes EAN-8 Yes Yes ITF No Yes QR Code Yes Yes RSS Expanded Yes No RSS-14 Yes No UPC-A Yes Yes UPC-E Yes Yes The following image depicts web app experience of QR or barcode scanner capability:

Error handling

You must ensure to handle these errors appropriately in your Teams app. The following table lists the error codes and the conditions under which the errors are generated: Error code Error name Condition 100 NOT_SUPPORTED_ON_PLATFORM API isn't supported on the current platform. 500 INTERNAL_ERROR Internal error is encountered while performing the required operation. 1000 PERMISSION_DENIED Permission is denied by the user. 3000 NO_HW_SUPPORT Underlying hardware doesn't support the capability. 4000 INVALID_ARGUMENTS One or more arguments are invalid. 8000 USER_ABORT User aborts the operation. 8001 OPERATION_TIMED_OUT Couldn't detect the barcode in the given time interval. 9000 OLD_PLATFORM Platform code is outdated and doesn't implement this API.

Code snippet

Calling ScanBarCode() API for scanning QR or barcode using camera:

const config: microsoftTeams.media.BarCodeConfig = { timeOutIntervalInSec: 30}; microsoftTeams.media.scanBarCode((error: microsoftTeams.SdkError, decodedText: string) => { if (error) { if (error.message) { output(" ErrorCode: " + error.errorCode + error.message); } else { output(" ErrorCode: " + error.errorCode); } } else if (decodedText) { output(decodedText); } }, config);

See also

How big is $1 billion?
How big is $1 billion?

The USA meaning of a billion is a thousand million, or one followed by nine noughts (1,000,000,000).

Read More »
Can reels go viral after a day?
Can reels go viral after a day?

Once your Reels is ready to be posted, your goal is to get your Reel to be a featured pick. This way your video will appear on the top of the...

Read More »
How many TikTok views is a dollar?
How many TikTok views is a dollar?

The best estimate is that you can make 2-4 cents per 1,000 views. These views are calculated by video, not your account as a whole. For example, if...

Read More »
Is K more than M in money?
Is K more than M in money?

Why is there such a difference in terms when they basically mean the same thing? K comes from the Greek world "kilo" which means one thousand and...

Read More »