Import Native ios/Android Code to Xamarin project - android

I need to import the native ios and android code in existing xamarin project same as react-native do for
ios : https://facebook.github.io/react-native/docs/native-modules-ios
android:https://facebook.github.io/react-native/docs/native-modules-android
is it possible to achieve in xamarin?
Thank you!

Unfortunately, I do not know how does the native modules work in React Native, however, there are Native Bindings that you could create and use in your Xamarin project.
Android:
Xamarin.Android supports the use of native libraries via the standard
PInvoke mechanism. You can also bundle additional native libraries
which are not part of the OS into your .apk.
iOS:
Xamarin.iOS supports linking with both native C libraries and
Objective-C libraries.

Related

Is there a way to use ReactNative library in Android/iOS?

I worked on a React Native library and we build some native functionality like implementing BLE. So we did that in Android and iOS folders under React Native. Now we want to use the same functionality in Native project iOS and Android (Native). Reason we built in React Native is coz we have a different project thats in React Native. But now we are trying to use this library in native projects. We are not sure how we can achieve that.
We don't have anything built in this Library other than in Android and iOS folders under RN project.
Attaching image of how we build or functionality in React Native but under Android and iOS folders. (We can just copy pate and create a native library but trying to avoid that).
I don't think so. you probably have to separate them to 2 different libraries and publish them independently

How to use Swift library in Android native project

We have iOS and Android native applications. iOS team implemented the Onvif library in Swift (which also contains Objective-C libraries). We would like to integrate it into the native Android application.
We discovered possible solutions:
Write the same code in Kotlin by ourselves
KMM - if it's possible to share the Swift library
Translate Swift into Kotlin using https://vinivendra.github.io/Gryphon/
Gradle plugin for Swift https://github.com/readdle/swift-android-gradle
We prefer to use the original Swift library as all bugs would be fixed there.
What option do you suggest?
Thank you

React Native app and importing native Android module

Since I did not get any answers from the previous post, I am posting again.
I have many experiences in Android native development but am a beginner in React Native. Wish to build a React Native app but need to find out these answers before I can start making architecture:
Is it possible to import a native Android module/ SDK (which is programmed in Java/ Kotlin) into React Native app? (I believe it is yes as I saw many good articles on the internet)
If I import the native Android module/ SDK to React Native app, does the app runs on iOS devices as well? Able to use APIs which native Android module/ SDK supports? (Or do I need a native iOS module/ SDK for iOS itself?)
I think this is similar to question #2. After importing the native Android module, does it also run on the web without a problem?
Looking forward to getting answers.
Many thanks,
Yes it is possible to integrate Android Native Modules.
No app doesn't run on iOS device if you have only Android SDK, You need to have a native iOS module to integrate iOS Native Modules.
For Web, I don't think so since both are native modules.
For more, please ref : native-modules-intro

A way to include android libraries in react native code

I have built an Android library that works perfectly fine with Android Applications when used as an AAR in an Android Studio project. Is it possible to use this same library in a React Native environment? If not, will it take a lot of effort to make this library compatible with React Native?
You can use this library to create library for React Native react-native-create-library
or
the official way to integrate Native Modules which will be found in
https://facebook.github.io/react-native/docs/native-modules-android
My answer is yes, it's possible, the android folder in react-native project is actually an android project, you can integrate a AAR lib here, make a function to invoke them, and call this function in .js file

Can Android library (jar/aar) be used for iOS in Xamarin

I know that I can add Android library (jar/aar) to Xamarin project. If I compile this project for iOS, will it work ? I read that it is not possible because of iOS do not have jvm. Is this situation same for Xamarin ?
Is this situation same for Xamarin?
Yes, you can't add jar to Xamarin.Ios.
Xamarin.Android or Xamarin.Ios is just a wrapper for Native Android or Ios.
You can use c# to code Xamarin.Android project, and run the Xamarin.Android project on a Android device,these all based on Android Callable Wrappers and Managed Callable Wrappers.

Categories

Resources