I have an appwidgetprovider which updates my sqlite database when the icons are "clicked" by the user. This is triggered by the onRecieve method and has worked fine but it now appears it will only work when records have been created by the activity first.
The database is handled by its own DBadapter
class and both the activity and the appwidgetprovider use this class in the same way:
mydb = new DBadapter(this);
mydb = mydb.open();
As the DBadapter creates the database in the onCreate method I cannot understand why the activity a) creates the database and b) can create the first record but the appwidgetprovider cannot.
The only other usage that the activity does do extra to the appwidgetprovider is using a database cursor to navigate through the database.
Are there restrictions to the appwidgetprovider where it cannot actually create the database if it has not already been created by the activity? If so this would mean that the app would have to be started first after being installed and then a dummy record would have to be created/deleted because I tested this and found that once the activity created and then deleted a record , the appwidgetprovider could then write to the database.
Forgot to mention that the onReceive calls a private method to do the repetitive task of adding the record to the database. This has been the case from the start and when records already exist it works but when there are none it does not create any records