v2.0.0
🚀 This release adds support for Capacitor 3
How to migrate from v1
to v2
?
Update your main package
First of all, you should make sure you have followed all the steps of the official Capacitor docs to migrate your main app to Capacitor 3.0, if you haven't already. Read more about this here.
Upgrade this package through npm
Run
npm install @capacitor-community/barcode-scanner@latest
npx cap sync
from your terminal.
Troubleshooting
If XCode or Android Studio give any errors after upgrading, check: troubleshooting
(Android) Registering plugin in MainActivity
From Capacitor 3 on, it is not necessary anymore to register the plugin manually in MainActivity
. So you can remove the following lines from your MainActivity.java
:
import com.dutchconcepts.capacitor.barcodescanner.BarcodeScanner;
add(BarcodeScanner.class);
Read more about this here
Plugin import
Additionally you can, but are not required to, change how you import this plugin.
Old way:
import { Plugins } from '@capacitor/core';
const { BarcodeScanner } = Plugins;
New way:
import { BarcodeScanner } from '@capacitor-community/barcode-scanner';
Read more about this here
Breaking changes
Error message unimplemented methods on web
The Error being thrown for unimplemented web method is a little different now (diff).
Old error message: method not available in web
New error message: Not implemented on web.
TypeScript definitions
Some TypeScript definitions were incorrect and are fixed now (diff)