Search code examples
androidcordovaphonegap-pluginscordova-plugins

Cordova App development - adding native aar


Hi I have created an aar library(it's a android-native sdk,with it's own APIs and activities) which i need to integrate, I followed Cordova plugin development

what should be the contents of Myplugin.java in src/android folder, is it mandatory to have a java file associated with my plugin?


Solution

  • Plugins are created to perform native specific android/iOS/Windows tasks. For example if your hybrid app requires camera to set profile picture then you might need to write your own camera plugin or get existing one from github.

    Now as you have added some aar file and you are planning to use some functionality present in that aar then you need to make your plugin class which should extend CordovaPlugin class and perform native specific operations in execute methos.

    Answer to second question yes you need to make Java class for each plugin and you need to declear class location in pref.xml .