You can catch IllegalStateExceptionif you try to open the same database again.
If you create an instance of a method DBHelperin the onCreatemain activity, this will be a record to close db in onDestroy. So, you can be sure that the next time onCreateyour database will not be open already.
If you have a link to DBHelperthe service, it should be open and closed in the service, not in action.
Application db, (, BroadcastReceiver)