Open jakubstankowski opened 4 years ago
That's usually a symptom of invoking the plugin too early. Can you wait until after the app has fully started?
thanks for response!
i add this two solution for delay starting functionality, first i add a showButton
flag to showing button, second in scanQrCode
function i used setTimeout
, unfortunetely this is not helping, i still get the same error
<Button v-if="showButton" class="btn btn-outline" text="Scan QR code" @tap="scanQrCode"/>
mounted() { this.showButton = true; },
scanQrCode() { setTimeout(() => { var barcodescanner = new BarcodeScanner(); barcodescanner.scan({ //basic options } ); }, 3000) },
this code is available here `
@EddyVerbruggen do you have some solution for this ?
Hi, I have the same issue. I did not try yet but I think that the problem is due to the new version : 4.0.1
Try downgrading to version 3.4.2
EDIT :
I have tried downgrading and it worked for me !
@MarioCat which version of nativescript you have ? Because i have 7.0.9
and now i get this error: 'No scan: TypeError: Cannot read property \'client\' of undefined'
@jakubstankowski I also have 7.0.9
Same Error with below environments:
Error: Cannot read property \'getApplicationContext\' of undefined @nativescript/core: 7.0.11 nativescript-barcodescanner: 4.0.1
Error: Cannot read property \'client\' of undefined @nativescript/core: 7.0.11 nativescript-barcodescanner: 3.4.2
Solved by building and deploy with Apk
The error only happen on Preview. After build and install the apk (android) on mobile and works fine
Hi, when i want start my vue-nativescript aplication i get error
Cannot read property \'getApplicationContext\' of undefined'
i use this version native script:
"@nativescript/core": "^7.0.3",
and this nativescript-barcodescanner -"nativescript-barcodescanner": "^4.0.1"
,there is my code: https://codesandbox.io/s/nativescript-vue-web-template-forked-iyjci
every logic is available in main.js, and in components > App.vue
I used Android 7 +
thanks for help!