jgilfelt / chuck

An in-app HTTP inspector for Android OkHttp clients
Apache License 2.0
4.68k stars 452 forks source link

Is it necessary to use ContentProvider? #66

Open ckjoker opened 6 years ago

ckjoker commented 6 years ago

Content providers can help an application manage access to data stored by itself, stored by other apps, and provide a way to share data with other apps.But in this repository, the chuck is used only in our own application, so I think it's better to use SQLite database to manage database directly.

gnumilanix commented 6 years ago

@CKJOKER Content providers provide an ease of working with and monitoring the DB changes. Yes, it requires developers to write more boilerplate code but, if you were to implement your own monitoring with BroadcastReceivers, that might be similar too.

Also implementing Content providers doesn't necessarily have to share data with multiple apps, it works nicely with Loaders and SyncAdapters. Though I would recommend looking for a less boilerplate solution. (I realized that your statement comes from the Android docs but, to be honest ContentProvider, SyncAdapter, and Loader does not have a good documentation.)

And Content providers are an abstraction to the SQLite database. The doc also meant SQLiteDatabase class not SQLite database itself. Which does not have any way to monitor changes