Ionic view and QR code scanning


#1

I’ve ported an angularjs bitcoin wallet over to ionic it’s here https://github.com/onchain/ionic-bitcoin-wallet

It seems to work well, however when I try to access the QR code scanner (com.phonegap.plugins.barcodescanner) It doesn’t work.

So I guess my questions is a general one. How do I configure cordova plugins so that they are recognised in ionic view ?


#2

Ionic View only has a limited number of plugins supported, currently it’s not possible to configure the app for additional plugins as these would need to be bundled with the app.


#3

Yes, I’m aware of that, but com.phonegap.plugins.barcodescanner is supported.


#4

Ok, I’ve misunderstood your general question. Sorry, so next question. Have you configured your app for plugins locally? Running ionic plugin add com.phonegap.plugins.barcodescanner?


#5

Thanks, Just tried that now, it creates a plugins folder.

I tried the ionic upload and still the same issue.

Perhaps it’s the way I access the plugin that causes an issue.

That happens here. https://github.com/onchain/ionic-bitcoin-wallet/blob/master/www/js/controllers/topbar.js#L8


#6

Can you show me the code you are using to call the plugin?


#7

https://github.com/onchain/ionic-bitcoin-wallet/blob/master/www/views/includes/topbar.html#L19 to call the controller method.

This takes you to this method in the controller. https://github.com/onchain/ionic-bitcoin-wallet/blob/master/www/js/controllers/topbar.js#L124

There’s a check of an isCordova variable, this gets set here https://github.com/onchain/ionic-bitcoin-wallet/blob/6cd05b6340d1f7fa1aefa6563508d09e2413ec40/www/js/services/isCordova.js#L3


#8

Are you checking cordova is ready prior to calling cordovaScan? Also did you know about http://ngcordova.com/docs/plugins/barcodeScanner/ it uses the same plugin but has a angular provider which wraps the function calls with promises.

Might be better to work with?


#9

I’ll give that a go. Thanks for all your help.