Porting Card.IO to C # Xamarin Studio

I'm having trouble trying to port Card.IO to Xamarin Android. Since I use C # instead of Java, I don’t know what to do with .so files and .jar files.

I tried to follow some of the steps described here: card.io Mono for Android (Xamarin Studio) , but I get the following two build errors that I do. I don’t know how to solve.

Here what i have done so far

  • Create a New Java Java Binding Library Project

  • Add the .jar and .so files from the Card.IO project with the existing folder structure. So, in the / libs folder there are four subfolders, and then one jar under / libs.

  • Add the following to Transforms / EnumMethods.xml to fix the compiler error:

    <mapping jni-class="io/card/payment/CardIOActivity">
        <method jni-name="onActivityResult" parameter="p1" clr-enum-type="Android.App.Result" />
    </mapping>
    
  • Add a link to the above library in my main application.

And then I came across these build errors:

The type or namespace name 'IN' does not exist in the namespace 'IO.Card.Payment' (do you miss the assembly reference?)

'A': member names cannot be the same as their closing type

Update

The first error on this line is:

public sealed partial class CardIOActivity : global::Android.App.Activity, global::IO.Card.Payment.IN {

The second error seems to be on this line:

public static global::System.Collections.IList A {

Any help is helpful, thanks!

+4
source share
1 answer

10 , io, xamarin... , ... 2 , "a" "A", , , "IN" ( , , ).

, , , (, ). , , . io jar. nevermind, :

  • , jar, .so ( )
  • EnumMethods.xml :

<mapping jni-class="io/card/payment/CardIOActivity">

<method jni-name="onActivityResult" parameter="p1" clr-enum-type="Android.App.Result" />

</mapping>

( int , .net xamarin onActivityResult ( card.io.jar) 3. Metadata.xml ( ):

<attr path="/api/package[@name='io.card.payment']/class[@name='A']/field[@name='a']" name="managedName">AProp</attr>

  <attr path="/api/package[@name='io.card.payment']/class[@name='M']" name="visibility">public</attr>
  <attr path="/api/package[@name='io.card.payment']/class[@name='M']" name="name">Mcl</attr>

  <attr path="/api/package[@name='io.card.payment']/interface[@name='N']" name="visibility">public</attr>
  <attr path="/api/package[@name='io.card.payment']/interface[@name='N']" name="name">Nifc</attr>

  <attr path="/api/package[@name='io.card.payment']/class[@name='L']" name="visibility">public</attr>
  <attr path="/api/package[@name='io.card.payment']/class[@name='L']/field[@name='a']" name="managedName">aProp</attr>
  <attr path="/api/package[@name='io.card.payment']/class[@name='L']/method[@name='a']" name="managedName">aMethod</attr>
  <attr path="/api/package[@name='io.card.payment']/class[@name='L']" name="name">Lcl</attr>

( ) iterfaces ( , , - )

  • .

  • AndroidManifest.xml :

<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" />

<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>

node ( node - )

  • CardIOActivity , ( , , , )

  • , , , ... , CreditResult OnActivityResult java cast: var scanResult = data.GetParcelableExtra(CardIOActivity.ExtraScanResult).JavaCast(); # cast .

- , , , - (, xamarin).

!

ps: answer @xamarin

EDIT: , github: https://github.com/wiadran/card.io.xamarin.binding.git

+5

All Articles