I am doing a keyboard for Android. I am willing to have a plugin structure to allow users to improve the prediction engine.
The prediction engine is done with Android NDK and it was coded in C. I have a wrapper class that calls the C code. An instance of this wrapper class is a field in the InputMethodService. The prediction engine gets updated by sending complete sentences. Something like:
public void updateEngine(String sentence);
Plugins should be calling that method. An example of the plugin can be a .txt parser. You select a txt file and the plugin will start sending to the main app all sentences. I would like plugins to be customizable, e.g.: They might have an screen where you can choose max sentence to send, to run on background, etc. The UI (don't know if it should be on the main app or the plugin, check my questions below) should have the possibility to ask the plugin how many sentence it can send (to do a progress bar).
My questions are:
- Should I use Intents or IPC?
I think I should use Intents since I just use primitive types.
- Should my operations be atomic or send an array of sentences?
I am willing to start with atomic operations but I am worried about performance.
- The plugins must be activities or Services?
They should be Activities and if necessary ("process on background" on) launch a service. Or perhaps they are just services and the main app takes care of the UI.
- Who should save information about the last execution. Plugin or the mainApp?
e.g. When was the last time the plugin was used.