Feb 1 |
3:50 PM |
Mark M. |
has entered the room |
Mark M. |
turned on guest access |
Feb 1 |
4:35 PM |
EGHDK |
has entered the room |
Mark M. |
howdy, EGHDK!
|
Mark M. |
how can I help you today?
|
EGHDK |
View paste
Hey Mark,
I was thinking about this today and wanted to quickly pick your brain about it.
|
Feb 1 |
4:40 PM |
Mark M. |
only so long as you put my brain back when you're done
|
EGHDK |
Alright, so last time we were talking and we
discussed that it's possible to take a db using adb from a non-rooted
device correct?
|
Mark M. |
um
|
Mark M. |
adb backup, for apps that allow backups, can back up a database without root
|
Mark M. |
and your app can copy your database file to external storage without root
|
EGHDK |
How would an app go about "allowing" a backup?
|
Mark M. |
I think it's allowed by default
|
Mark M. |
android:allowBackup on the <application> element controls is
|
Mark M. |
there's a new Lint warning for you to be explicit about allowing/blocking backups
|
EGHDK |
Oh alright. So I'll look into "allowBackup". Thanks
|
Feb 1 |
4:45 PM |
EGHDK |
My next question is more of a "how would you go about this" type of question.
|
EGHDK |
I have a sqlite database of baseball players and
their stats. What would be the best way to bake this into my application
so people can access it while offline, but also check for updates
online?
|
Mark M. |
if by "bake in" you mean you want to ship a pre-populated database with your app, use SQLiteAssetHelper
|
Mark M. |
|
Mark M. |
also covered in the book
|
EGHDK |
Do I include it in the application, and then run
some code on startup to move the file into
/data/data/com.test.baseball/baseball_db?
|
Mark M. |
yes, and that's what SQLiteAssetHelper does for you
|
Feb 1 |
4:50 PM |
EGHDK |
Coolio. Great, and one last thing. Would it be
smart to delete the original sqlite db after it's been imported with
SQLiteAssetHelper?
|
Mark M. |
you can't
|
Mark M. |
if it is baked into your app, it's there forever
|
Mark M. |
you cannot modify an APK at runtime
|
EGHDK |
Even if it's a raw directory?
|
Mark M. |
well, it won't be with SQLiteAssetHelper
|
Mark M. |
but resources and assets are read-only
|
Mark M. |
they cannot be modified or removed from the APK at runtime
|
Feb 1 |
5:00 PM |
Mark M. |
and that's a wrap for today's chat
|
Mark M. |
the transcript will be posted shortly to http://commonsware.com/office-hours/
|
Mark M. |
the next chat is Thursday at 4pm
|
Mark M. |
have a pleasant day!
|
EGHDK |
has left the room |
Mark M. |
turned off guest access |