card.io单声道为Android(Xamarin工作室) [英] card.io Mono for Android (Xamarin Studio)

查看:428
本文介绍了card.io单声道为Android(Xamarin工作室)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人成功创建了card.io包装他们愿意分享,可以用在单声道的Andr​​oid应用程序,也可以有人揭示一些轻我在做什么错了?

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?

  1. 创建一个新的的Andr​​oid的Java绑定库项目
  2. 添加.jar和从 card.io SDK 3.0 .so文件。 3 ,一定要使用现有的文件夹结构
  3. 添加以下变换/ EnumMethods.xml解决一个编译器错误:

  1. Create a new Android Java Bindings Library Project
  2. Add the .jar and .so files from card.io SDK 3.0.3, be sure to use the existing folder structure
  3. 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>

  • 添加参照上述库在我的主要应用
  • 编译的一切,我可以访问card.io类:

    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);            
        };
    }
    

    不过,我总是$ psented,出现以下错误p $:

    However, I am always presented with the following error:

    此设备无法使用相机读取卡号

    注:

    • 在我尝试了几种不同的物理设备上运行
    • 的card.io.jar文件具有的生成操作:EmbeddedJar
    • 的.so文件,有一个生成操作:EmbeddedNativeLibrary
    • 在我明确设置的阿比在项目的 ItemGroup
    • 每个.so文件
    • I have tried running on several different physical devices
    • the card.io.jar file has a Build Action of: EmbeddedJar
    • the .so files have a Build Action of: EmbeddedNativeLibrary
    • I've explicitly set the Abi for each .so file in the Project ItemGroup

    我很新至Android / Xamarin,所以花的时间比编码研究。

    I'm very new to Android/Xamarin, so spend more time researching than coding.

    的.so文件,不会出现要在的.apk文件

    The .so files do not appear to be in the .apk file

    编辑:

    的.so文件似乎得到回升,由编译器。 编译后,如果我检查 OBJ /发行/ 文件夹中有一个子文件夹中的 native_library_imports 包含在根据所支持的阿比型合适的子文件夹中的.so文件。

    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.

    然而,.so文件仍然没有出现在最终的.apk文件

    However, the .so files still do not appear in the final .apk file.

    logcat的输出:

    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
    

    感谢

    推荐答案

    嗯,我终于有些实验后解决了这一点。

    Well, I finally resolved this after some experimentation.

    1. 按照我原来的职位4个步骤
    2. 提取card.io SDK图书馆项目,所以你最终的文件夹结构的根目录: ProjectRoot /库/ &lt;保证SDK文件和ABI子&GT;
    3. 添加.jar文件到项目的文件夹(选中添加链接选项)
    4. 添加在文件夹复制到你的项目的根目录下(不包括.jar文件)
    5. 您可能需要手动编辑 .csproj的文件中添加阿比目标每个的.so 文件
    6. 确保文件中有一个生成操作 EmbeddedJar
    7. 确保在的.so 文件都有一个建设行动 EmbeddedNativeLibrary
    1. Follow the 4 steps in my original post
    2. Extract the card.io SDK to the root of the library project so you end up with a folder structure of: ProjectRoot/libs/<the sdk files and abi subfolders>
    3. Add the .jar file to the Project Jars folder (select the add a link option)
    4. Add the libs folder to the root of your project (excluding the .jar file)
    5. You may need to manually edit the .csproj file to add the Abi target of each .so file
    6. Ensure the .jar file has a Build action of EmbeddedJar
    7. Ensure the .so files have a Build action of EmbeddedNativeLibrary

    @tomwhipple - 感谢您的贡献。我想upvote你的答案,但显然我没有足够的声誉。

    这篇关于card.io单声道为Android(Xamarin工作室)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆