Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Cordova Android on Ionic Requires alert to activate the scanner before CardIO.canScan #43

Closed
seatechdev opened this issue Sep 3, 2016 · 10 comments

Comments

@seatechdev
Copy link

seatechdev commented Sep 3, 2016

Required Information

  • Mode (Mock/Sandbox/Live): Sandbox
  • Cordova Plugin Version: card.io.cordova.mobilesdk 2.0.2 "CardIO"
  • Platforms (iOS/Android/Both): Android
  • Device OS Version and Device (iOS 9.x on an iPhone 6, Android Marshmallow on Nexus 6, etc.): 5.1.1 and 6.1
  • PayPal-Debug-ID(s) (from any logs): N/A

Issue Description

I am using Ionic platform.
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 Android not any other platform.

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);
@lolptdr
Copy link
Contributor

lolptdr commented Sep 7, 2016

@sbasi5576: See my forked commits, hoping to get this merged soon: #44

@seatechdev
Copy link
Author

Thanks. How do I install this fix?

@lolptdr
Copy link
Contributor

lolptdr commented Sep 7, 2016

@sbasi5576 Go to my forked repo and install it instead of card.io's version. Or you can make the changes yourself by following the changes I have in #44. Look at the changes here: 6157d3e

@seatechdev
Copy link
Author

would these the lines highlighted in red or green? sorry i have never submitted anything on github. I'm someone who is coming back to tech after spending more than 10 years in business through the bschool route :)

@lolptdr
Copy link
Contributor

lolptdr commented Sep 7, 2016

@sbasi5576 click on the #44 link and scroll down until you see the commit hash and click on it. You will then see a unified diff view that summarizes the changes I made. Red lines mean changed code. Green means new code. Use my changes (right hand side) and see if those changes help you.

Please google "learn github" or "how to use git" so you can maximize github usage! Submit your repository to github and I can take a look if you want.

@seatechdev
Copy link
Author

@lolptdr I have literally replaced the original files with the files you are trying to check-in. The scan was not successful without the alert. It didn't resolve the issue I am trying to.

@lolptdr
Copy link
Contributor

lolptdr commented Sep 8, 2016

@sbasi5576: please checkin your project into github and we can take a look

@seatechdev
Copy link
Author

seatechdev commented Sep 8, 2016

@lolptdr I would love to but unfortunately I have the customer proprietary code in it.

@seatechdev
Copy link
Author

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.

@seatechdev
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants