To Create a Module for OpenTok Android:
These are the steps I would follow.
- Create a new Android module:
titanium.py create --type=module --id=com.tokbox.ti.opentok --platform=android --name=opentok-titanium
- Follow the installation instructions from OpenTok for Android. (Hint: I added a separate section down below to help you get through their instructions.)
- Make sure the module runs:
ant run.emulator
orant install
. - Try running their sample, fully in JAVA, completely separate from Titanium. Make sure it works, and you know what it should look like. Then, figure out what exactly you need from their API. Or, if you're feeling ambitious, decide you want everything. Work to strip down the example to just the surface area that you need. Simplify it down to the least number of files you feel makes sense.
- Write an example/app.js that demonstrates how you want the module to be used. For example, maybe you'd start off by requiring the module, then setting some API + Session keys, then calling some API, etc.
- Based on the documentation, port what you need in to your module. Reference the Appcelerator Android module dev guide and open source Android modules for inspiration.
- Write documentation for the module to specify what the various properties, methods, etc are, so that other developers can figure out how to use the module.
- When you're done, submit a PR to OpenTok and revel in your creation and contribution.
Some Hints for Step 2:
- .jar files go in
lib/
. - .so files go in
platform/android/libs/armeabi/
- Permissions go in
timodule.xml
, and you can see an example in the open source PayPal module for Android