Due to some comments, the question in a nutshell:
How can a widget access its own sqlite database?
Why doesn't it work with a simple DatabaseAdapter class?
Are certain permissions required?
Are there any restrictions imposed on Remotevie / AppWidgetProvider to access their own database (without ContentProvider).
The question seems simple, but the details follow if someone really wants to know why I ask:
I have the following setup:
I have a regular Android application that comes with quite a lot of HTML pages in a resource folder. Due to the size of the application, the preferred installation location is an external SD card. It works great.
This means that the application cannot contain the widget, because the widget must be in the internal ROM.
Instead, the widget will be read from the application database on an external SD card. This is achieved using ContentProvider / ContentProviderClient.
So far, this works great.
This widget should now support some persistent configuration options based on each instance. Therefore, the AppWidgetProvider class cannot use the settings, because they will be applied to each class.
So, to save the (rather complex) instance configuration data, I want the AppWidgetProvider class to have its own small sqlite database.
Now that I can access the application database from the widget using the contentprovider, it seems that the widget cannot access its own database. I have a database adapter class in a widget project; inside the AppWidgetProvider, I have a context, but no email seems to be happening.
The calls to the database adapter go through OK (I made several protocols), but when I look at the tables, the recording does not happen.
Why? Do I really need a ContentProvider inside the widget to access the widget database? I do not want to go this way, because when I realized access to the application database from the widget, I had to go through the ContentProviderClient instead of the ContentProvider. That would be very cumbersome. Since I need a little more than a CRUD acccess, this will obviously be related to creating a custom ContentProviderClient. The android docs clearly state that "you donβt need a provider to use the SQLite database if the use is entirely in your own application." So IMHO, would that mean the widget can access its database directly? Do I need special permissions? I suspect that since widgets work like RemoteViews in the process of working with home screens, is access to db somehow limited? Any thoughts, ideas, allusions to this?