Adding Esri Map View


#1

I am trying to add an Esri Map View using their Android SDK. I did some research and found a tutorial that I can use native-script to use any other library. I already configure the android in the gradle app. The problem I am facing is I am trying to add this into XML
<com.esri.arcgisruntime.mapping.view.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height=“fill_parent”>
</com.esri.arcgisruntime.mapping.view.MapView>
I don’t know how to convert this layout into nativescript how would you do this.


#2

Hi @noe
in the createNativeView method of the plugin,
you would do,
this.nativeView = new com.esri.arcgisruntime.mapping.view.MapView()

To read more about making UI plugins,
I recommend you read this doc
https://docs.nativescript.org/plugins/ui-plugin-custom


#3

So the only way to use this is to create my own plugin. @multishiv19


#4

@noe
It isn’t the only way.
You can directly write JSified native code in {N} if you want to.
Writing a plugin would be the best way to go about it IMO.


#5

Am sorry I don’t understand the terminology JSified native code in {N}. Can you show me an example? I am new using the native script.


#6

These links might help you

https://docs.nativescript.org/core-concepts/accessing-native-apis-with-javascript
http://searchcode.nativescript.rocks

and also read some plugins, to see how java code is written using JS in {N}

Cheers! :slight_smile:


#7

One last question? I found this piece of code mapView = new MapView(this); The this keyword in android how do I do that in native script.


#8
const app = require("application");

mapView = new MapView(app.android.foregroundActivity); 

it would look something like that for android, in {N} code


#9

Thanks for your help I let you if that works and I am able to implement my map view. I will try to create a plugin and share with the community a lot to learn.


#10

Sure @noe
That’ll be great!


#11

I’m curious, did you ever get this to work?