Reputation: 31
I need to create an Ionic app that uses a native Android SDK in order to perform the functionality I want. The SDK is an AAR and allows me to develop an Android app that handles things like web services, bluetooth, etc. The problem is that I need to develop the app cross platform using Ionic and that means ultimately creating a Cordova plugin. I've looked around the net for information on Cordova plugins but I'm not quite sure how to develop a plugin larger than an echo because thats all anyone ever seems to show.
So my question is, where do I begin? Do I develop the Android app first and then copy the java code into my Cordova plugin or do I develop the Cordova plugin at the same time as creating the java code based on the Android SDK I've been provided with?
If I build the Cordova plugin without the Android application first I won't be able to test, so maybe I should build the Android app first and then port it into a Cordova plugin?
Thanks
Upvotes: 3
Views: 1480
Reputation: 1093
Check out this reference for plugging into an AAR file: https://github.com/bitstadium/HockeySDK-Cordova
Upvotes: 0
Reputation: 30356
where do I begin?
Use an existing (real) Cordova plugin as reference.
Depending how your SDK is packaged, depends how you'll need to install it from your plugin.
If your SDK is a JAR file, you'll need to place it in your plugin folder and add an entry to your plugin.xml
to deploy it. For example cordova-plugin-cipherlab-rs30 does this.
Or if your SDK is available via Maven, you can use <framework>
tags to satisfy the dependency via Gradle: e.g. cordova-plugin-facebook.
Do I develop the Android app first and then copy the java code into my Cordova plugin
I wouldn't recommend this if you're ultimately developing a Cordova plugin, otherwise you will create more work than necessary.
If I build the Cordova plugin without the Android application first I won't be able to test
This is not true:
/path/to/my/plugin
cordova create myplugintest
cd myplugintest && cordova plugin add /path/to/my/plugin
cordova platform add android
/path/to/myplugintest/platforms/android
/path/to/my/plugin/
Upvotes: 3