About sqlite use - android

There are some things my application needs to do on first start up(first startup after update) . These actions could be described in a .txt file and then when it is the case read the file and do according to it ,or on the other hand (I lean to use this option) a sqlite database could be used to store the information . The apk file would be shipped with an .txt file/prebuild sql db stored in res/raw or res.asset and then copied into proper space and used. This I have figured out how !, though I'm not sure which option of this two would be the fittest ? One thing that is unclear to me is how could sqlite version mismatch affect me, and if it serious enough to take into consideration ? I 'm using Android api level 4 (Android 1.6) and the future application might be used on several different devices , with different api levels.

These actions could be described in a
.txt file and then when it is the case
read the file and do according to it
,or on the other hand (I lean to use
this option) a sqlite database could
be used to store the information .
Or, they could be implemented in Java.
Well the actions that the application
needs to perform on install / after
update , according to the update
version and the pre update version of
the application
Why not just implement this as regular Java code in your app?
Or, as Albert Einstein wrote, in homage to Occam's Razor: "Make everything as simple as possible, but not simpler."

Related

Android(<=2.2) Large File Downloads using android market apk expansion downloader library

Has anyone tried using market apk expansion downloader library (available as an add-on) for downloading large files on android <= 2.2? The source code is a bit difficult to understand and I was not able to figure out how it can be used for downloading any large files in general. Are there any alternatives for downloading large files on lower android devices(apart from writing my own DownloadService which I wouldn't prefer doing if there is something already available).
I have not tried to use it but the docs do state the the expansion downloader library is compatibile with API Level 4, taken from the docs:
Note: By default, the Downloader Library requires API level 4, but the
APK Expansion Zip Library requires API level 5.
I completely agree that the source code is difficult to follow, however it was designed in such a way to be fault tolerant to network issues.
I think you can take the sample and roll with that, however I found it was very difficult to test.
We ended up going with our own in the end (using an Arbitrary server) to host the downloads.
I do not believe there are any alternatives, however the downloader library does have a few gems. For instance the Expansion Zip Library can be used independently of the Downloader Library and is a great way to read content directly from the zip.
The only challenge would be writing your own downloader service and performing a CRC check.
Seems like API 4 or >
The expansion API is used for "permanent" file extensions to your application, they don't want you to move them or delete them or even unpack them etc. but use them in place, it's unclear what would happen if you did but I suspect a lot of odd side effects.
You also don't have direct control of when this file is downloaded, it has to be associated in the market and then it happens automatically unless for some reason it "fails" in which case when your app starts you are expect to initiate the process manually and then you need to use the Download Libary, else it's automagic as my 3 year old says.
From your post you may be looking for a way to get large files (more than one) and do what you want with them, if so this is not a good method to do that since every time you add a new file via the market it would tell your users you have an updated version and overwrite the older file (though you can use the patch extension to avoid that if you are updating the original but that only moves it back one step)
All of that is here what expansions files are for and how to use them
If you just want a method to get large files using your own server take a look at the support package and specifically the loader and loader manager. They also say they are making source code to the extension library downloader and zip file manager available but I haven't bothered to check that yet.

RDF databases on Android

I'm working on a project on mobile RDF databases for Android. Therefore I'm looking for open source databases to include in my Android project. However, it's difficult for me to find mobile versions of existing RDF databases.
What I've found so far:
Jena TDB database
Oracle Berkeley database
Unfortunately I haven't found mobile versions of Sesame, Virtuoso, AllegroGraph, etc.
Does anyone know some other RDF databases for Android?
I'm not an Android developer, so perhaps I'm overlooking something, but Sesame comes as a collection of maven modules, each a separate Java jar file. You can pick and choose the jar files you need and as far as I'm aware, you should be able to use them on Android straightaway. I don't think there's any need for a separate "mobile version", is there?
I am taking a look to Triple Place.
a light weight and flexible Triple Store for Android. It uses a
indexing structure similar to the one in Hexastore. TriplePlace uses
TokyoCabinet as persistent storage system.
You can find a brief presentation of its features here.
You can use SQLite to store RDF data and make queries for the triples, but SPARQL couldn't be done. Here is a good reference:
http://infolab.stanford.edu/~melnik/rdf/db.html
I would also take a look at 4store.

Configuration file in Android. Does that exist?

I have some configuration I want to save it in my Android application and read it whenever I need , for instance, the server URL that it should try to access like that.
Is there any similar mechanism like web.config in ASP.NET available in Android?
A central configuration file that can be set up manually and then read by the application? Any help would be appreciated!
We use a .properties file in assets folder. It works out very well for us as we support multiple carriers with this, write to it (in case some values, sent from server, need to change. This is done at app start time, thus making our code configurable from server).
You can throw things like that into your strings.xml file. But, since you can't actually modify these values in real-time (since it's a distributed application rather than running on a server), throwing it into a constants class is quite acceptable.
Use Shared Preferences.
Here's a link Shared Preferences
You can use sq lite database files for it. You have a native API to read and write those and on top of that a command line tool.
If you want to create an XML file instead, then it's no different than any other xml file (unless you are thinking about the Shared Preferences, which use an xml format to save the data, but I believe it's not the best API for your application).
I was stumped on this too, but came across Managed Configurations in the Android documentation.
Managed configurations, previously known as application restrictions, allow the enterprise administrator to remotely specify settings for apps. This capability is particularly useful for enterprise-approved apps deployed to a managed profile.
It allows you to set a default value in case you rather not getting into the enterprise admistration business but leaves that option open for the future.
There is a caveat. This only works if your app is registered for EMM. Otherwise you will retrieve an empty map of restrictions.

How to handle .mbp files within android or windows?

i have a .mbp file generated by one of my android applications.
This is NOT a MobilePocketreader file. It is a Mediabase Package file.
Can some android library handle it (probably does), or can some windows app handle it.
Never mind. I understood how to solve this.
Its surprising that no one could answer this.
You can simply use the sqlite browser to browse through the entire table set and data.

Sqlite encryption for Android

I have an Android app that has been already developed using SQLite.
The DB is quite large (over 100 Megs) so it can be deployed only on the SD card.
The data inside the DB is sensitive so for this reason we need to encrypt the DB.
The default SQLite binary on the phone does not allow encryption or to add a plug in (extensions).
I manage to compile the SQLite using NDK with the encryption extension (I am calling this SQLiteS - from secure) but I still need to figure out how to copy the Sqlite API and bind it to the new SQLiteS binary.
The idea is to not change the already developed code using the SQLite default API excepting the package name.
Any idea of how can I accomplish this ?
Tryp getting a native jdbcsqlite driver onto Android.
which makes sqlite3_* calls(JNI).
Use the aapt tool to link the library(sqliteS) into the .apk file.
Also, you can change the sqlite3_* names(in SQLiteS.so you built) so that it doesnt refer to sqlite.so file provided by android.
Let me know the solution.
I know this is not an answer for your question, but you could try the (free, open source) H2 database. It supports data file encryption as well. There are some disadvantages however, for example some operations are quite a bit slower. You would need to use the JDBC API because the SQLite / Android database API is not yet supported. Disclaimer: I'm one of the H2 committers.
Use sqlCipher. SQLCipher is an open source extension to SQLite that provides transparent 256-bit AES encryption of database files.
See http://sqlcipher.net/

Categories

Resources