Pre-populated databases in Android: Trying to put the pieces together -



Pre-populated databases in Android: Trying to put the pieces together -

i have been gathering info in site , others best way include pre-populated sqlite database in android. confirm understood reasons of why should trivial… not.

so please tell me if next conclusions right or wrong?:

the main reason many people suggest copying pre-populated database file assets folder "/data/data/your_package/databases/" because there no way access database file in assets folder or doing overly complex (?). (could clarify of these 2 answers right 1 ?) another of import reason database files in assets folder must copied somewhere else because files in location cannot updated. if database in assets folder open, useful if such database not have modified. update: i launched new thread focussing on issue: opening read database straight in assets folder. files in assets folder can 1 mb size (unless have file extensions such mp3). note restriction not relevant if: database smaller 1 mb, or not mind dividing database in 1 mb chunks , putting them @ runtime, or not mind distributing database file mp3 extension. if database file copied assets folder "/data/data/your_package/databases/", there no way delete original database file @ assets folder avoid having duplicated file. because files in assets folder cannot modified.

making puzzle bit more complex: found in comments accepted reply of question: how ship android application database? copying database assets folder location in fact not work on devices running 2.3+. accurate ? if true, best alternative download database file web @ first run ?

thanks clarification.

you're confusing apks actual folders on device.

think of apk install bundle - not unlike msi of windows world. whole goal of install bundle securely authenticate , deliver code , resources device. in naive implementation, unpack said code read-only location, resources somewhere read-writeable , on merry way.

to save space, android bit smarter - code , resources never leave signed archive, you know it's ones set in , don't waste space storing code twice. there's real magic going on in class loader allows unzip classes on fly that's besides point.

so, essentially, in compressed install bundle read-only (by virtue of beingness signed). it's job "installer" , move whatever resources need read-writeable location. of course, can't touch apk 1 time it's in place since allow malware , defeat whole purpose of signing.

hope clears confusion.

android

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -