The android content provider has methods for the normal suspects {insert, delete, query, update} but if I want to send control messages there is no obvious mechanism. Suppose one of the tables managed by the needs to be reset, cleared and reloaded. How can this be done? I have several approaches each of them seems a bit hackish.
1) create an activity(or service/receiver) to to the job.
The activity does a bulk delete and insert.
This seems like the least hackish but when the content provider starts the database helper creates the tables and initializes them.
It seems inefficient to duplicate the initialization code in the content provider's database helper and in a separate activity.
2) hijack the content provider api. A dummy table could be created where the insert (or update/query/delete) method would invoke otherwise inaccessible methods.
3) use multiple inheritance to make the content provider also an service (or activity). This is probably closest to what I want but I don't know how to do this. It feels dangerous, especially if it were an activity.
4) have a service content-provider pair Similar to (3) but hopefully without the warts. The service would have aidl for doing all the control kinds of things. Such as, loading lookup tables, clearing tables, purging expired tuples, ... If this were done, the service how would the service be started? by the content provider?