How to insert a huge database into the apk file

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

How to insert a huge database into the apk file

Postby alex.lv » Fri Jun 05, 2009 4:08 am

I'm writing an application that uses an SQLite database. And I do not know how to ship the database with the application. How can I make the database into the APK file when I build the application? Is there any tips? Thanks!
Note: The database is almost 5M.
alex.lv
Freshman
Freshman
 
Posts: 4
Joined: Sun May 31, 2009 7:53 am

Top

Postby Emmanuel7 » Mon Jun 08, 2009 7:02 pm

I've done it for my game, Word Prospector, and I think it was a bad idea.
In order to ship your application with your database, your database must be in the .apk, and then in the database folder.
So your application, once installed, will be at least 10 Mo. And it's a no no for users.

I wrote an article on this subject on my blog.

hope it helps,
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby alex.lv » Tue Jun 09, 2009 2:05 am

Already done! Thanks!
alex.lv
Freshman
Freshman
 
Posts: 4
Joined: Sun May 31, 2009 7:53 am

Postby gpmoo7 » Mon Jul 06, 2009 2:03 am

I need to ship a database (1M) in my application.
Can you tell me how you did it.

Thanks
My Android App: http://montrealtransit-for-android.googlecode.com/
-----
HTC Nexus One (AT&T/Canada)
HTC Magic (Rogers/EBI1)
HTC Dream (Rogers)
http://twitter.com/gpmoo7
gpmoo7
Freshman
Freshman
 
Posts: 7
Joined: Sat Jun 06, 2009 3:09 pm
Location: Montreal, Canada

Postby Emmanuel7 » Mon Jul 06, 2009 11:21 am

As I've just said in my previous post, I made a tutorial on my blog :
http://androidblogger.blogspot.com/2009/06/tutorial-how-to-access-android-database.html

And, as I also said in my previous post, keep in mind that it means you will have the 'installation' AND the 'installed' version of your database once you application has run, so for a 1 Mo database, your application will be at least 2 Mo, and it's quite heavy ( it means users will complain, and your notation will resent it ! )
That's why I gave up this roadway.
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby gpmoo7 » Mon Jul 06, 2009 2:44 pm

Thanks for your help.
I think I'm going to ship the db with my app for now and I'll think of a better solution in the future.
Users may complain but my app is going to be free for now ... so :P
My Android App: http://montrealtransit-for-android.googlecode.com/
-----
HTC Nexus One (AT&T/Canada)
HTC Magic (Rogers/EBI1)
HTC Dream (Rogers)
http://twitter.com/gpmoo7
gpmoo7
Freshman
Freshman
 
Posts: 7
Joined: Sat Jun 06, 2009 3:09 pm
Location: Montreal, Canada

Top

Postby gpmoo7 » Tue Jul 07, 2009 11:45 am

My Android App: http://montrealtransit-for-android.googlecode.com/
-----
HTC Nexus One (AT&T/Canada)
HTC Magic (Rogers/EBI1)
HTC Dream (Rogers)
http://twitter.com/gpmoo7
gpmoo7
Freshman
Freshman
 
Posts: 7
Joined: Sat Jun 06, 2009 3:09 pm
Location: Montreal, Canada

Postby Emmanuel7 » Tue Jul 07, 2009 3:28 pm

Actually, it is the exact same method that I'm using.

The only thing is I gave you a wrong link :)
Here was the good one :
http://androidblogger.blogspot.com/2009/05/how-to-ship-application-with-pre-baked.html

So, as in this other blog, I copy the database from the .apk to the database dir.

I can't even claim this guy copied me, he posted it before !!
:)

As a side note : there is a sensitive comment that said that it could be a good idea not to embed the database in the .apk, but to dowload it as a first installation step, to avoid to have the database twice on your phone !
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby gpmoo7 » Tue Jul 07, 2009 3:40 pm

Emmanuel7 wrote:The only thing is I gave you a wrong link :)
Here was the good one :
http://androidblogger.blogspot.com/2009/05/how-to-ship-application-with-pre-baked.html

I found this article on your blog but the thing that is not in your blog is that the sqlite db needs to have an "android_metadata" table.
But thanks a lot for your help.
My Android App: http://montrealtransit-for-android.googlecode.com/
-----
HTC Nexus One (AT&T/Canada)
HTC Magic (Rogers/EBI1)
HTC Dream (Rogers)
http://twitter.com/gpmoo7
gpmoo7
Freshman
Freshman
 
Posts: 7
Joined: Sat Jun 06, 2009 3:09 pm
Location: Montreal, Canada

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests