need help to use barcode scanner
See original GitHub issueI am new to capacitorjs and trying out your plugin BarcodeScanner.
Followed the instructions, defining build.gradle, adding BarcodeScanner.class in MainActivity. Also, run ‘ionic build; ionic cap copy; ionic cap sync’ and then re-compile and run on Android device. In the Ionic App, I have a service providing startScan() function that will be trigger by a user click:
public startScan = async () => {
console.log(`here in startScan()`);
// const { BarcodeScanner } = Plugins;
BarcodeScanner.hideBackground(); // make background of WebView transparent
const result = await BarcodeScanner.startScan(); // start scanning and wait for a result
// if the result has content
if (result.hasContent) {
console.log(result.content); // log the raw scanned content
}
}
However, it seems it has no function at all. After clicked and called the function, it has no scanning window popped. Can anyone help to give me some hints? Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Barcode Scanner App- QR Code Reader for Android - YouTube
This video demonstrates an app that can be used as a QR code and barcode reader and scanner. Using this QR and Barcode...
Read more >Android 101: How To Scan / Use a QR Code - YouTube
So maybe you've seen one of these square barcodes that have a bunch of dots in them somewhere and wondered, "What the hell...
Read more >A Quick Lesson On Barcode Scanner Basics - YouTube
Barcode scanner introduction by POSGuys. We show the basic differences between a Contact Scanner, a Laser Scanner, and an Imager.
Read more >How to Use Barcode Scanner for iPhone and iPad - YouTube
In this tutorial you will learn how to use Barcode Scanner for iPhone. Don't forget to check out our site http://howtech.tv/ for more...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your help is superb @tripodsgames! you saved me from the middle of the sea 😁😎
For those who are newbies trying out this plugin, on top of the Ionic/Angular tutorial. The detailed steps:
Edit tutorial-photo-gallery-angular/android/app/src/main/java/io/ionic/pg/ng/cap/MainActivity.java, add lines as indicated.
Edit android/app/src/main/AndroidManifest.xml according, add the lines indicated by leading “+”
Hope the above would provide some hints in getting started to use capacitorjs.
You need to hide every element on your document. I implemented in the follow way using css and js:
I made the scanner interface inside a div with
.scanner-ui
class to hide it when the scanner is not enabled. Then i put the.scanner-hide
class in my<ion-app>
to hide the view when the scanner is enabled.App Component HTML:
When the scanner is open i added the
.qrscanner
class to the<body>
, this will make the interface visible and the<ion-app>
invisible.To add or remove the
.qrscanner
class: