I am writing something, a Content Provider, and multiple applications. The Service creates new data towards the Content Provider's SQLite database every a few minutes approximately plus at user input, and is supposed to run virtually forever without anyone's knowledge. The application, when running, displays data drawn in the Content Provider, and will also be rejuvenated whenever the Service puts more data in to the Content Provider's database.

Considering that the Service only card inserts in to the database once every 5 minutes, just when was the best time for you to call SQLiteOpenHelper's getWritableDatabase() / getReadableDatabase()? Could it be around the onCreate() from the Content Provider, or must i run it each time there's an insert() and close it in the finish of insert()? The information being placed every a few minutes will contain multiple card inserts.

Regarding your particular question, if you are planning to utilize a ContentProvider by doing this, you may decide to go outdoors-and-close-every-place pattern. There's no onDestroy() hook in ContentProvider, so there is no wonderful time to shut the database. With increased frequent/random access designs, you just need to accept it. Inside your situation, you might as well close up.

That being stated, I am not obvious why you are disturbing having a ContentProvider to begin with.