I'm using NativeScript as the UI/mobile access layer for an app. For now, the app will only be run by me on an Android device, so cross-platform support isn't an issue. The core of the app is implemented as a Rust shared library with a JNI interface, and my primary goal is ease of development/iteration as I refine this code.
I'd like to write my Java JNI interface code directly in my NativeScript app--that is, compile the code alongside the platform-specific Java, without writing it in a separate library that gets pulled in. But it seems like the platform-specific code is auto-generated and not meant to be user-modified.
Is it possible to easily copy a few hand-written Java classes into my final NativeScript app, while using NS for the mobile interface layer? Are hooks something that could help with this?
Thanks for any pointers.
It allows devs to use XML, CSS, and JavaScript to build Android, iOS, and even the Universal Windows Platform applications. Unlike Cordova, which uses a WebView to render the app's UI, NativeScript uses the native platform rendering engine, which means it provides a truly native user experience.
NativeScript makes cross-platform mobile app development easy, fast, and efficient. We are a consulting company and use NativeScript for apps internally and externally for customers.
With NativeScript 5.2.0 release, you are now able to add native code for both Android and iOS in your application. For Android, you can place your Java classes in <path to project's App_Resources dir>/Android/src/main/java
. For iOS you can place your Objective-C implemenation in <path to project's App_Resources dir>/iOS/src
directory.
Here's an example application that demonstrates how to add native source code directly in your app and call it from JavaScript: https://github.com/rosen-vladimirov/appNativeCode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With