0

Platforms: Android 5.1 and Android 6.1

Unless I put an alert before the CardIO.canScan the camera scans the card or form can take a manual entry but doesn't return anything. It seems like the alert triggers some event that invokes the scanner's complete capability. I tried using other methods such as consoles.log or $cordovaDialogs.beep(3) so that I don't have to use an alert but no success. The issue is only for iOS not any other platform. Even tried device ready that doesn't work.

CardIO.scan({ "collect_card_number": true, "collect_expiry": false, "requireExpiry": false, "collect_cvv": false, "requireCVV": false, "collect_zip": false, "shows_first_use_alert": true, "disable_manual_entry_buttons": false, "keepApplicationTheme":true, "useCardIOLogo":true, "hideCardIOLogo": true }, onCardIOComplete, onCardIOCancel );

alert("Success");

CardIO.canScan(onCardIOCheck);

techwestcoastsfosea
  • 686
  • 3
  • 10
  • 21
  • are you invoking this in platform ready function! – Gandhi Sep 04 '16 at 05:31
  • @Gandhi yes. I am invoking the entire controller at the platform ready. ionic.Platform.ready(function(){ then run everything inside the controller. Do think this needs to be more localized? May be only before CardIO.canscan? – techwestcoastsfosea Sep 04 '16 at 18:51
  • I just tried wrapping only CadIO.canscan with the platform ready function it didn't work. – techwestcoastsfosea Sep 04 '16 at 18:56
  • all I m guessing is that if it works with alert, it could be something to do with some delay. Why can't u jus create a vanilla bare bone Cordova project using CLI and put this code to test under device ready function to isolate the issue cause? – Gandhi Sep 05 '16 at 03:50
  • I have tried causing delays in different ways but that didn't work. The alert triggers plugin...so i guess i need to get creative somehow.. – techwestcoastsfosea Sep 05 '16 at 07:36
  • does it mandates user interaction?? – Gandhi Sep 05 '16 at 08:05
  • Yes it does. If you don't have the alert, the camera still gets activated, card scan happens but it doesn't return anything to the scope after scanning. Alert starts popping up before the camera activates but stays around until after the scan is complete. It doesn't pause scan instead runs in the background and then comes to the foreground. The CardIO plugin definitely has a priority over alert but behaves differently with and without it. – techwestcoastsfosea Sep 05 '16 at 21:39
  • The process flow in the app is as follows: From parent view, click on Scan button, that invokes the CardIO plugin, scan the card, take the card value as an input to popup a modal with a list of cards to select from. Select a card that is assigned to the card number and save it. – techwestcoastsfosea Sep 05 '16 at 21:42
  • @Gandhi I did more debugging by using document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { The device becomes ready but Camera by iteself is not activated. The message I get is Device Camera not available. – techwestcoastsfosea Sep 09 '16 at 06:17
  • could be a possible permission issue if you are using android marshmallow. – Gandhi Sep 09 '16 at 12:01
  • @Gandhi - No the behavior is same on both the 5.1.1 and 6.1 – techwestcoastsfosea Sep 10 '16 at 01:33
  • did you raised issue on the plugin page itself? – Gandhi Sep 10 '16 at 04:49
  • Yes, I did but got no help. One developer tried helping as he was trying to check in some code to the plugin but his code didn't help either. I am testing right now as we speak. My analysis shows that the alert triggers an event in cordova that not only fires the camera but also enables to engage it with the angular $scope. Without alert even if you manage to fire the camera at the second attempt you are asked twice to scan the card and if you do it that card is scanned but nothing is returned in the scope or the response by itself. It is something Android specific regardless of the ver. – techwestcoastsfosea Sep 10 '16 at 05:17
  • Other things I have attempted are setInterval with Corodva.exec, setTimeout, moving the alert in canScan and onCardIOCheck. Nothing helped. Alert starts right before CardIO.canScan(onCardIOCheck) What else is interesting is that if I simply use javascript example provided on the CardIO github and run it without ionic it works fine. I wonder if I can run that in side my controller somehow. – techwestcoastsfosea Sep 10 '16 at 05:22
  • than could be a possible ionic framework issue then... – Gandhi Sep 10 '16 at 11:57

1 Answers1

0

CardIO.canScan(onCardIOCheck) was interrupting the scan flow. I commented it out and that addressed the issue.

techwestcoastsfosea
  • 686
  • 3
  • 10
  • 21