How to SQLCipher for a pre made database - android

I have a 15mb database .
I need to encrypt it , so it can't be readable easily .
I'm using SQLCipher , it works fine for a new database but I've made my database and I need to encode it now . How can I do so ?
My database is in asset folder or will be downloaded when user runs the app for the first time, I don't want my app to get data from internet because it should be an offline application.
How can I encrypt my database with all it's data?

You will want to use the sqlcipher_export(…) function, specifically example 1 found in the documentation here. You can also find an example of this within the SQLCipher for Android test suite here.

Related

How to use Pre populated Database with the real device

I have made my database using greendao and Have been testing it on the emulator so far. It was working so perfectly. And there was no memory leak and any error whatsoever .
But now I am stuck to just one single point. and that is how do I use this
pre-populated database in the application on the real device. How can I push my database into real device?
Some one suggest me to put my database file in the assets folder and later on Application start just copy it into device.
The suggestion was good, but it is not helping me as there comes the error when I run my application for the first time , but after that it goes forward But then greendao is unable to get the database it find.
The error I got at first run is as under.
can not open database
Buton second run it goes forward and there in next activity I am getting data in list using greendao , but it is not finding that database.
Please tell me :
1) How can I push my pre papulated database into the device to be use by greendao methods.
2) What is a way that is supported in all devices.
Please share me the code. Its been a long I am trying to get over this. But nothing is helping me out.
I made a simple dictionary demo for Android, which manipulates prebuilt database in assets folder with GreenDAO 3.x.
All you have to do is extended the DevOpenHelper class that GreenDAO generates.
Here is the project link: Sawloih.

Android App database setup

I am creating an android app, UI/UX and andoid work are finished. I am new to database setup. Can anyone tell me which type of database I should use to store descent amount of data like signup details and app using details. Should I use DBMS or RDBMS or SQlite? help me. Thank you.
In my point of view , you have to use SQLite for android apps.
There are several benefits in SQLite like :
SQLite is embedded into every Android device.
Using an SQLite database in Android does not require a setup procedure or administration of the database.
You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform.

Android App: can I use iOS sqlite? If not, how do I create a local database from a database in the cloud (Parse.com)?

I am making an Android version of an iOS app that I already have. I want to use a local database so that the user can use most the app offline.
Initally I thought I could use the sqlite database created by Core Data in Xcode, but as I am reading things online it seems like this is not possible. Is this true? Or is there a good way to export it to something Android could use?
If not, I want to create a local database with values from a database on the cloud(I use Parse.com). How can I do this? The data on the cloud doesn't change very often (maybe twice or thrice a year) if that makes any difference.
This is a good tutorial to handle preloaded databases:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Essentially, once you have your precreated database, put it in your assets directory in your apk. Then on first app use, copy this from assets to "/data/data/YOUR_PACKAGE/databases/" directory.
You have to create the database by code in Android, using a DatabaseHelper http://developer.android.com/guide/topics/data/data-storage.html#db. If you want to use your already created database you will have to export it to SQL statements and then "import" them to your application.

Browsing Android SQLite database within application

Does anyone know of Android code I could embed directly in my app, such that I could browse my SQLite database directly from within my app?
If not, how about code that reads the SQLite metadata, and dumps table and column names and data to the log? (In JDBC, I'd use databasemetadata to get table info, and then table metadata to get column info...)
I know I can browse on an emulator, and I can copy the db off the device and then point a db browser at it. But this would be a lot more convenient for me during development. This would of course be used only for test databases with tiny amounts of data. Any suggestions?
Have a look at this question: browse data in Android SQLite Database It may not be exactly what you're asking, but may be sufficient for your needs.
Alternatively, there's a sqlite database browser app in the market, which you may be interested in (I haven't tested it myself): https://market.android.com/details?id=com.xuecs.sqlitemanager&hl=en
I think this is what you are looking for .
Using the library in the link below you can browse your app database from your app https://github.com/sanathp/DatabaseManager_For_Android
With this library you can manage your app SQLite database from you app itself.
you can view the tables in your app database , update ,delete, insert rows to your tables .Everything from your app.
Its a single java activity file ,just add the java file to your source folder.When the development is done remove the java file from your src folder thats it .
It helped me a lot .Hope it helps you too .
You can view the 1 minute demo here : http://youtu.be/P5vpaGoBlBY

which kind of database to use with android app?

I am developing an android program for my university. I am confused about which database to use.
What I want is that when the user is connected to the internet the program will check for any updates in the backend database. If there is any, the program will sync it with Android device.
Let's assume that after while the user opens the program in place with no internet, the program will work just fine because the file is already in his mobile.
I chose Access and created .xml file and by the help of this site: XML resources in android. I learnt how to read it.
Actually this program is my senior project. I dont want the judges to ask me why didn't I use MySQL or SQLite.
Which database system should I use? Is Access the right database system to choose?
I want to do a program that looks just like Univ of Kent program.
Parsing XML could take time, also in XML you have no choice but to load the whole file.
SQLite is fast, simple to use and very dynamic.
Android offers a very simple SQLite API. Androoid SQLite API
If you are interested in reading more about all the data storage types in Android visit this link
It depends upon your requirement. lets say you want to build something which handles and stores the data on your device locally then SQLite is a good option (you can use firebase as well).if you want to do some sort of calculation on you data on a remote server then firebase is a best choice .
by using firebase you can store your data generated by your users and then if you want you can carry out some analytics as well.
i would prefer Firebase .

Categories

Resources