My app has these parts
A. Main activity
B. Widget provider
C. Sync Adapter (talks to the cloud)
D. Local persisted data (small, about 1-2KB).
A,B,C read/write from/to D. The app does not interact with other apps and all the parts are in a single apk.
-
Can I implement the storage D as a singleton of a class with plain Java API that is not a ContentProvider? (I prefer not to use SQLite but a single flat file that I manage, this code and a proprietary API already exists. Adding proper synchronization should not be a problem).
-
Are all the parts A,B,C,D guaranteed to run in the same process and same class loader, sharing the same singletons?
-
Currently the app does not have an Application class. Should add one and tie the D singleton to it or is there is no real need to have an Application class?
-
Anything else I should be aware of?
Yes you can.
Yes if they are in the same application (so defined in the same AndroidManifest)
No you do not need it.