freezy Wrote:Well, the use cases aren't really different from a user's point of view: The user wants to browse the DB wherever he is, if possible. Now, if you only copy the raw .db and rely on that solely, you probably will have problems keeping it up to date (however even as an offline-only browser, you'll have to address this issue eventually).
Technically I haven't played around yet with Android's content providers, but if that's a way to abstract the whole thing and potentially even open it to other apps, I'm all in.
It just seems silly for a user to have to download two apps for the same thing and since you're here and you seem to be eager to improve your app, merging the two projects seems like a good idea.
that's right, the main drawback at the moment is the update-process for the database: there is none. you have to copy the db-file every time, you want to refresh your db. That's because, currently we're not able to write to the database file and won't be, because for this we'll have to create an own db from scratch to be able to update (maybe in future releases). But the big advantage with this proceeding is, we're not depending on one specific database schema (for example XBMC) but can use many different.
as a quick win, we should focus on the content provider-option. there you can access the movies abstracted from the yambro-database (that means XBMC or EmberMerdiaManager schemas at the moment) with only a few lines of code, for exmaple like this:
Code:
// generic Uri for all movies
Uri movieBaseUri = Uri.parse("content://de.luck539.yambro.model.MoviesProvider/movies");
// special Uri for unique movie with id
Uri myMovieUri = Uri.withAppendedPath(movieBaseUri, "23");
// what columns do I need?
String[] projection = new String[] { "m_title", "m_imdb", "m_studio", "m_tagline" };
// get a Cursor with filters and sort order:
// Cursor cursor = managedQuery(movieBaseUri, projection,"m_title LIKE '%007%'", null, "m_title");
//
// or get the Cursor for the specific movie:
Cursor cursor = managedQuery(myMovieUri, projection,null, null, null);
The main interesting things are how the different online/DB-accesses will be distinguished. For example always try to get online content and use the offline db as fallback, if the online-call fails? Or actively setting online/offline mode in settings?
When we're also able to update the offline db, more questions arise:
how/when to update the offline-db?
option 1)
every request we receive from xbmc will be updated in the offline-db? that would generate unnecessary wait-times.
option 2)
trigger a full update from settings menu?
option 3)
trigger delta updates since last refresh from settings (how to detmerine the last access/update?)
best regards, yambro