How do I Create Components from my Existing Apps?

An Android component for the Developer Garden Component Marketplace is essentially a JAR file containing the “.class” files for your component. Sometimes, your component will require additional resources like string resource bundles, graphics and layouts. Unfortunately in the eclipse IDE, Android does not merge and generate a new R.java file containing pointers to some of the resources in a JAR file. So at this time, these should be packaged in a ZIP file with instructions for the developer on how to import these resources into their project.

If you already have an application, portions of your application can be exposed as components for developers. For example, suppose you have a shopping comparison application where you can scan barcodes and perform a pricing lookup for a product. One useful function in this application that you may want to sell to other developers is the barcode reader. So, to expose this feature as a component, you have to isolate the parts related to barcode scanning. Start a new project and bring over the source files related to that feature. When the project is created, you can right click on the top node of your project tree and select the “Properties” option. In the dialog that appears, be sure to select the “Is Library” checkbox. You will need to ensure that you have no dependencies on other parts of your application. Remember that you will be distributing binary JAR files to developers. So, this component must be self-contained and not have dependencies on your original application. 

To create a JAR file in Eclipse, right click on the top node of your project tree and select the “Export” option. You will only want to select the files in your “src” directory. When the Android SDK exports this, your JAR file will contain only the compiled “.class” files. Once you have built a JAR file containing the functionality, try using it in a small test application designed to adequately test the functionality and interfaces of your component. Note that you will be submitting this test application in source code form when you publish into the Developer Garden Component Marketplace. 

Once you are happy with the component, you can refer to the Verious Licensing SDK to embed the licensing code into your component. You will also be embedding a public key into your component. In your test application, add the code from the license SDK to pass in a sample license key you obtained from Developer Garden Component Marketplace (see Verious Licensing SDK for details). The application should function the same as before with a valid license key. If you modify the license key, the API should stop working. Submit this test application that contains the license code to the Developer Garden Component Marketplace. The Developer Garden Component Marketplace will use your sample application to help with the approval process.

Finally, you should have documentation on how to use your component along with an API reference guide. The reference guide should document all of the APIs that the component exposes. We recommend using an open source tool called doxygen to generate the reference guide from your “.java” source files. In addition to the reference guide, you should also include a user/developer guide. This should describe what your component does, how it works, and describe the various features and how to use those features in an application.

We recommend this document to be PDF or HTML formatted. Please refer to one of our sample components for an example of how to create proper documentation for your own component.