Has anybody successfully created a card.io wrapper they're willing to share that can be used in a Mono for Android application or can somebody shed some light on what I'm doing wrong?
Add the following to Transforms/EnumMethods.xml to resolve a compiler error:
<mapping jni-class="io/card/payment/CardIOActivity">
<method jni-name="onActivityResult" parameter="p1" clr-enum-type="Android.App.Result" />
</mapping>
Everything compiles and I can access the card.io classes:
using IO.Card.Payment;
private void WireupScanCardButton()
{
Log.Debug(this.GetType().Name, "WireupScanCardButton");
this.ScanCardButton.Click += delegate
{
Log.Debug(this.GetType().Name, "ScanCard.Click");
var intent = new Intent(this, typeof(CardIOActivity));
// Required for authentication with card.io
intent.PutExtra(CardIOActivity.ExtraAppToken, "<MY PRIVATE TOKEN HERE>");
// Customize these values to suit your needs.
intent.PutExtra(CardIOActivity.ExtraNoCamera, false);
intent.PutExtra(CardIOActivity.ExtraSuppressManualEntry, true);
intent.PutExtra(CardIOActivity.ExtraRequireExpiry, false);
intent.PutExtra(CardIOActivity.ExtraRequireCvv, false);
intent.PutExtra(CardIOActivity.ExtraRequireZip, false);
// Run the Activity
this.StartActivityForResult(intent, 0);
};
}
However, I am always presented with the following error:
this device can not use camera to read card numbers
NOTES:
I'm very new to Android/Xamarin, so spend more time researching than coding.
The .so files do not appear to be in the .apk file
Edit:
The .so files do seem to get picked up by the compiler. After compilation, if I check the obj/Release/ folder there is a subfolder native_library_imports that contains the .so files in appropriate subfolders according to the supported Abi type.
However, the .so files still do not appear in the final .apk file.
logcat output:
04-18 08:12:20.462 D/ActivityAddPaymentSource( 5824): ScanCard.Click
04-18 08:12:20.472 E/ActivityManager( 191): exception bw.write()java.io.IOException: Transport endpoint is not connected
04-18 08:12:20.472 I/ActivityManager( 191): Starting: Intent { cmp=com.onetab.android/io.card.payment.CardIOActivity (has extras) } from pid 5824
04-18 08:12:20.472 D/PowerManagerService( 191): acquireWakeLock flags=0x1 tag=ActivityManager-Launch
04-18 08:12:20.492 D/ActivityAddPaymentSource( 5824): OnPause
04-18 08:12:20.492 E/Sensors ( 191): GsSensor: line +83 ~~~handle===0~~en==1~~!n
04-18 08:12:20.502 E/Sensors ( 191): GsSensor::setDelay: line +113 ~~~handle===0~~ns==1553152~~!n
04-18 08:12:20.502 E/Sensors ( 191): GsSensor::setDelay: line +113 ~~~handle===0~~ns==-2135896001~~!n
04-18 08:12:20.542 W/card.io ( 5824): cardioScanErrorNoDeviceSupport: This device cannot use the camera to read card numbers.
04-18 08:12:20.572 E/ActivityManager( 191): exception bw.write()java.io.IOException: Transport endpoint is not connected
04-18 08:12:20.572 D/PowerManagerService( 191): acquireWakeLock flags=0x1 tag=ActivityManager-Launch
04-18 08:12:20.582 E/Sensors ( 191): GsSensor: line +83 ~~~handle===0~~en==0~~!n
04-18 08:12:20.622 D/ActivityAddPaymentSource( 5824): OnResume
thanks
The Android logcat should show a more specific error message, but this problem is due to missing native libraries. (For normal Android projects these live in the /libs
directory, with architecture specific subdirectories.)
These are the .so
files that you mention are missing from the .apk. They contain all of the image processing logic, so card.io can't scan if they are not there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With