You could abstract it into the plugin but you don’t have to, in fact I wouldn’t because if you ever update your dependencies (in package.json) the manual change to the source file will be overwritten so you have to remember to go change it anytime that happens. Also, you typically don’t put node_modules in a repository so others won’t have those manual changes.
The better approach, IMO, is to just tap into the api exposed by the sdk that is added via this plugin. To make sense of that, let’s suppose you didn’t even use this plugin to consume the google map sdk (which is easily done). You would add the dependency to your app’s app.gradle (it may be titled build.gradle now) file located in
App_Resources/android and when you build your app the build process would find the google map dependency and package the sdk into your app exposing all of its functionality. The plugin is doing this for you here https://github.com/dapriett/nativescript-google-maps-sdk/blob/master/platforms/android/include.gradle by using the plugins
include.gradle file which declares the dependency and that’s how it’s added during the build step of your app using the plugin.
That may not be the most coherent explanation ^^^ but it should be helpful to understand some things.
Okay so now that we know you have the sdk available in your app, you need to find out how to use it of course.
CameraPosition class from the sdk: https://developers.google.com/android/reference/com/google/android/gms/maps/model/CameraPosition
Here is how you use that in your project: https://github.com/dapriett/nativescript-google-maps-sdk/blob/master/map-view.android.ts#L44 which is just finding the namespace and getting to the class to use it. Nothing fancy. When I’m consuming a library I usually create a
const equal to it for better readability and less typing later on if it’s called multiple times like this: https://github.com/bradmartin/nativescript-panorama-imageview/blob/master/panorama-imageview.android.ts#L17
Hopefully this makes sense.