kokokok
kokokok

Reputation: 1102

How to call methods of a .so file from Xamarin Android?

I have a .so file from an Android driver manufacturer. They provide an example in Java. The problem is that my app is developed in Xamarin Android. Is it possible to call methods of a .so file from Xamarin?

Upvotes: 1

Views: 664

Answers (1)

FreakyAli
FreakyAli

Reputation: 16547

1.Create a lib folder in your project

2.Under that create additional subfolders for the platform: armeabi, armeabi-v7a etc.

3.Add your .so files to the appropriate directory. Make sure they are set to type AndroidNativeLibrary or whatever it is.

4.Create p/invoke signatures for the c functions you want to call.

5.Call those functions.

Note: Your .so files should be valid EFL executables. It means they should be compiled for ARM processor in Android Devices. In order to do this, you should compile them with Android NDK

Goodluck!

Upvotes: 2

Related Questions