B4A Library card.io

This is a shortcut wrap for this Github project. Just wanted to see if I could kick start it from within B4A. Have not added any code to return scan results to the B4A app.

You need to download the B4A lib files from the link below:
https://drive.google.com/open?id=0B4g9tud5lvjgMFNLSWR1SmtOS2M

I need to sort out the "locale" classes. Have translated them all into English for now as I picked up numerous "undefined character" problems while those classes contained the original languages that were present. Will revisit this sometime to make sense of it.

Posting:
1. B4A sample project
2. LibRes.zip - extract it and copy the folder and its content to be on the same folder level as that of the /Files and /Objects folders of the B4A project
3. DemoRes.zip - extract it and copy the folder and its content to be on the same folder level as that of the /Files and /Objects folders of the B4A project

Take note of the B4A manifest file.

Sample code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aCardIOA
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\LibRes
#AdditionalRes: ..\Demores

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim cioa As CardIO

    Private Button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    cioa.Initialize("")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click

    cioa.startCardIO

End Sub

1.png


2.png


Libs enabled:

upload_2017-7-16_12-56-49.png
 

Attachments

  • DemoRes.zip
    2.3 KB · Views: 272
  • b4aCardIOA.zip
    8.1 KB · Views: 284
  • LibRes.zip
    49.4 KB · Views: 287
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi Johan. Work without error, but when i scan dont return null .... i see only rectangle all line is green ... but nothing happen
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan. Work without error, but when i scan dont return null .... i see only rectangle all line is green ... but nothing happen
You need to make sure that the credit card fills the complete green rectangle else it will not scan the card. I cannot take a screenshot while the scanner has been started. Not sure why - for some reason the screenshot comes out blank...
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan. Work without error, but when i scan dont return null .... i see only rectangle all line is green ... but nothing happen
Can you take a screenshot of it so that I can see what you mean?
 

MarcoRome

Expert
Licensed User
Longtime User
You need to make sure that the credit card fills the complete green rectangle else it will not scan the card. I cannot take a screenshot while the scanner has been started. Not sure why - for some reason the screenshot comes out blank...
Yes is complete green... but anyway 1 time on 4 - 5 give me result and the result number credit card isnt correct
 

MarcoRome

Expert
Licensed User
Longtime User
Here a movie ( tried Samsung S7 ) if you see a lot time for scanner and the result is wrong ( number card )

 

Johan Schoeman

Expert
Licensed User
Longtime User
Here a movie ( tried Samsung S7 ) if you see a lot time for scanner and the result is wrong ( number card )

It says "this video is unavailable" when I try to play the video.

Here is a screenshot of scanning my card and the setting that I have enabled. It reads the credit card number 100% correct.

correct1.png


20170716_132511.jpg
 

Johan Schoeman

Expert
Licensed User
Longtime User
Seems to me it is looking for this:

B4X:
public enum CardType {
    /**
     * American Express cards start in 34 or 37
     */
    AMEX("AmEx"),
    /**
     * Diners Club
     */
    DINERSCLUB("DinersClub"),
    /**
     * Discover starts with 6x for some values of x.
     */
    DISCOVER("Discover"),
    /**
     * JCB (see http://www.jcbusa.com/) cards start with 35
     */
    JCB("JCB"),
    /**
     * Mastercard starts with 51-55
     */
    MASTERCARD("MasterCard"),
    /**
     * Visa starts with 4
     */
    VISA("Visa"),
    /**
     * Maestro
     */
    MAESTRO("Maestro"),
    /**
     * Unknown card type.
     */
    UNKNOWN("Unknown"),
    /**
     * Not enough information given.
     * <br><br>
     * More digits are required to know the card type. (e.g. all we have is a 3, so we don't know if
     * it's JCB or AmEx)
     */
    INSUFFICIENT_DIGITS("More digits required");
 

MarcoRome

Expert
Licensed User
Longtime User
Seems to me it is looking for this:

B4X:
public enum CardType {
    /**
     * American Express cards start in 34 or 37
     */
    AMEX("AmEx"),
    /**
     * Diners Club
     */
    DINERSCLUB("DinersClub"),
    /**
     * Discover starts with 6x for some values of x.
     */
    DISCOVER("Discover"),
    /**
     * JCB (see http://www.jcbusa.com/) cards start with 35
     */
    JCB("JCB"),
    /**
     * Mastercard starts with 51-55
     */
    MASTERCARD("MasterCard"),
    /**
     * Visa starts with 4
     */
    VISA("Visa"),
    /**
     * Maestro
     */
    MAESTRO("Maestro"),
    /**
     * Unknown card type.
     */
    UNKNOWN("Unknown"),
    /**
     * Not enough information given.
     * <br><br>
     * More digits are required to know the card type. (e.g. all we have is a 3, so we don't know if
     * it's JCB or AmEx)
     */
    INSUFFICIENT_DIGITS("More digits required");

Mhh...i tried also with another card (MasterCard). The wrapper work without problem so i think that is library that have some problem.
 
Top