Search code examples
androidnativescriptarcgis-runtime

NativeScript : Use platform specific native library without a multi-platform plugin?


We're trying to use ArcGIS's Android Runtime SDK in NativeScript (it has no nativescript plugin) but we have accessed that rewriting the whole library as a multi-platform plugin would take too much time.

My question is, how can we utilize the native library directly but only the android version of it?

This is the library: https://developers.arcgis.com/android/latest/api-reference/reference/packages.html

Also, is it possible to use it without a custom UI plugin? I don't understand how to add the mapView to the app .xml

For example, in their AndroidStudio tutorial they mention the following steps and I'm not sure how to translate them to NativeScript

enter image description here

Source : https://developers.arcgis.com/android/latest/guide/develop-your-first-map-app.htm


Solution

  • I'm not quite sure what you mean by re-writing the whole library, you never have to do that.

    Plugins are being written to wrap the native library with simple user friendly JS api / methods, it necessarily need not to be cross (or multi) platform either.

    You may even directly access any third party library within your project as soon you mark them as dependency in your app gradle file.

    Here is how you access native apis.

    For instance if you want to create an instance of LocatorTask, this should work once you add the library as dependency in your NativeScript project.

    const locatorTask = com.esri.arcgisruntime.tasks.geocode.LocatorTask("URI_HERE");
    locatorTask.loadAsync();