Is there any way I can create executable or library compatible to Android using Xamarin

MADBMADB USMember

I have code in C# core to provision, register IoT devices to IoT hub Azure using Azure C# sdk

I would like to use that to work in Android Device.

Is there any way I can build executable and libraries compatible to Android using Xamarin

Tagged:

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Try to incorporate Java libraries into your Xamarin.Android application by creating a Bindings Library.

    Xamarin.Android offers two ways to use these third-party libraries:

    • Create a Bindings Library that automatically wraps the library with C# wrappers so you can invoke Java code via C# calls.

    • Use the Java Native Interface (JNI) to invoke calls in Java library code directly. JNI is a programming framework that enables Java code to call and be called by native applications or libraries.

    Check the tutorial:
    https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/

  • MADBMADB USMember

    Hi
    I am not clear with the explanation.

    My requirement is I have C# core code to provision, register IoT devices to IoT hub Azure using Azure C# sdk.
    I want to use the same library in Android to build an executable (not app) to perform these operations.

    I am interested to know If there is a way to do this.

    I am not clear why should I plugin java libraries, Could you please explain me in detail if possible?

  • JarvanJarvan Member, Xamarin Team Xamurai

    If you have code written in Java or an SDK that you need to access from Xamarin. You can create a binding project to access the file to reference a Jar or Aar file in your Xamarin project.

  • MADBMADB USMember

    I have code in C# (dotnet core and dotnet Standard)
    And I would like to use that to build an executable(not app), which need to run on Android.

    Any clue How can we do this?

Sign In or Register to comment.