Creating DroidScript Plugins on Mobile with AIDE

Install AIDE on your Smartphone

You can directly download it from Google Playstore. You should run it at least one time before continuing!

Install the AIDEPluginGen in DroidScript

This is a free application written by Chris F. and Chris M. in DroidScript which allows you to simplify the install process of your plugin. It also includes a template for the Java and JavaScript code, a documentation template as well as a step by step guide (which is pretty help-full) how to get started with it.
You'll see many parallels to this post here - but it includes some additional informations which you should know.

You can download it from the DroidScript Forum. The link will download an .spk file - you have to open it with DroidScript and it will automatically be added to your projects list.



Create the Plugin Template

To create a basic template you have to launch the AIDEPluginGen and press 'Create New DS Plugin'


Type the name you wish for your plugin and press 'Create Plugin Template'
You should keep the 'minimalistic' check box disabled to see which methods are available later.


This will generate a folder in /sdcard/AppProjects/MyPlugin


Building the Plugin

Be sure that you have an icon.png file under res/drawable/ - otherwise you'll get an error. Normally this would be the app icon but as long as we're creating plugins we (theoretically) don't need it.


Now you have to launch AIDE and open your project folder.


Press the 'run' button to compile the java code - but don't install it on your device (because it is a plugin and doesn't include a GUI or anything)


Install the Plugin in DroidScript

Launch the AIDEPluginGen again and press 'Build DS Plugin Zip'


This will create a file /sdcard/DroidScript/Plugins/MyPlugin.zip


At last (Re)start DroidScript to install the plugin.


Test it out!

You can try whether everything worked well by going into the Plugins section in the DroidScript Docs.
You should see your plugin listed there.


Open it and you'll see the documentation page of your plugin


Try to run any of the examples at the bottom - if they work you're done :)



You can finally begin building your Java plugin for your DroidScript application!

Additional Informations

You will find your source code at the same directory as in AndroidStudio - just the .html and the inc file are somewhere else - you'll find them in the "plugin/" directory in your project folder


If you have questions about Android Java you should have a look at https://developer.android.com - there you'll find a complete reference for EVERYTHING which is available for android, as well as examples and much more. Check it out!

If you have questions about the JavaScript part (DroidScript) feel free to ask in the official DroidScript Forum.


Happy coding!

Comments

Post a Comment

Popular posts from this blog

Creating DroidScript Plugins on Mobile with AIDE - 2 (DS SDK)

Creating DroidScript Plugins on Desktop PC with Android Studio