-1

Is it possible to pre-populate my ContentProvider before I publish my apk? My ContentProvider is backed by an sql db.

reason (for the curious):

Google is complaining about indexing my app because of blocked content. The blocked content would be solved if data was already loaded. A possible solution would be to pre-load the contentProvider and then package the apk.

Nouvel Travay
  • 6,292
  • 13
  • 40
  • 65
  • A `ContentProvider` cannot be "pre-loaded", because a `ContentProvider` is simply an implementation of an API. If you explain what your specific `ContentProvider` is using for a backing store (SQLite database? flat files? random numbers?), we might be able to suggest data distribution strategies for that backing store. – CommonsWare Jul 20 '16 at 17:58
  • Well, if the content is blocked, hiding it somehow won't help since in the end it is still there. – Henry Jul 20 '16 at 17:59
  • @CommonsWare I forgot to add that. Fixed: sql db – Nouvel Travay Jul 20 '16 at 19:26

1 Answers1

0

You can package a SQLite database in assets/ and unpack it on first use. SQLiteAssetHelper is a nice library for helping you do this.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491