Possible to put SQLite database in project folder in Android Studio? - java

I am working on an android app for school that requires user account, sign up, and login functionality. I was wondering if it is possible to save the SQLite database file into the project folder instead of into the device that it is running from. For example, if I insert an entry into the database on one emulator, and I start the app on another emulator that entry will still be there.
Is it possible to store an SQLite database into the project folder with the source code?

Related

Is it possible to fill out google-service.json later after application build as apk

Is it possible to fill out google-service.json keys later after application build as apk file where users fill it from text field inside the application? I want the users able to connect to spesific firebase connection without needed to get my source code and configure it in android studio first.
I do found similar question but its hard to understand from my level of knowledge or satisfy my question: dynamic google-service.json after apk is generated

Dropbox Java API : Limit access for an user

I'm working on an android app, that has to get resources from a database located on dropbox for various reasons.
I created an app limited to a folder on my dropbox's app page.
I hava data stored on this folder (i know how to do that), and want my android app to get this data. I don't want the app to be able to put files on this dropbox folder.
I know that I can generate an auth token for my app, but I need to manually "activate" it on a web browser to make it usable.
Is there a way to automatically anthenticate my android app, on any device running it, and prevent users to alterate my database, only allowing them to read data from the folder, through the dropbox's java API ?
Thanks for any answers !

Manage sqlite on real device with eclipse

I'm using galaxy note with rooted software but I'm retying to find some way to test and manage and browse all my sqlite contents values and tables via eclipse
I have used com.questoid.sqlitebrowser_1.2.0.jar plugin but it give me disabled button in DDMS
note : I'm deploying my app on real device not emulator
I'm not sure if this gonna helps you. But, i had the same problem with questoid and the problem was that i tried to access a database file that wasn't closed by my application.
I also was using WAL Sqlite database. If you are using a WAL sqlite database and then you found 2 files with extension .shm and .wal, then your database file is not closed.

Cannot read database on actual android device

I create an application that is using SQLite in Android. I have no problem when launching it using the Android Virtual Device, everything was fine and all recorded data could be loaded.
Right now, I'm trying to install it on my phone. But, I don't know why, the data can't be loaded. Should I do any configuration on it, or should I put my database file in my project somehow?
In addition, my database name is dbtaxi, and my package name is com.syariati.finalProject.

How access existing sqlite database on Android Emulator?

So im new to working with databases in android, and I cant seem to figure out how to view a created database.
I created the database adapter class and in my main activity class.
I run it in the emulator with no issues, but how do I view the contents?
The book im reading says "examine the file system of the Android device/emulator using DDMS. The database is created under the database folder"
and has an image of the database under a database folder in Eclipse.
I dont know what the first part really means (using DDMS?) and have no idea where the /data/data folder is that people mention.
Even running SQLite3 in CMD and typing ".tables" doesn't yield any database.
In Eclipse Go to Window > Open Persepective > Other > DDMS. Navigate to the DB like the image from the answer below, select the database then click on the floppydisk icon to pull the file from the device on the top right.
In the emulator, the location in DDMS should be /data/data/com.yourNamespace/databases in the File Explorer tab.
This is a pic of the DDMS perspective. In the File Explorer tab on the right, you would drill down to the databases folder. These are virtual folders, so you won't find them on your system. To examine the db, you would select the icon for Pull file from the device (sorry, it got cropped out in this screenshot) and open that file in SQLite.
Retrieve databse from app from cmd
->adb -e shell
--->su root
--->cd data/data/app.name.com/databases
--->cp databasename.db /sdcard/DCIM/
--->exit
--->exit
->adb pull sdcard/DCIM/databasename.db
In android studio run your app in emulator and click on "Device File Explorer"
Explore data/data/{appname}/database. Then right click and save your database file. That's it.
If you did not root your phone, only your app can access your database and it is not possible to view it through DDMS. You will need to implement a function that copies the database to the storage card (make sure you have the external storage permission). From there, you can view your database with an app like aSQLiteManager.
Alternatively, you can just use the Log method along with cursors to print out whatever information you need, but the first method will provide you with a more graphical way of perusing your database.
The database is created on the emulator. Should be in /data/data/[package]/databases/
You can use DDMS to navigate the emulator's filesystem and pull the database file from it to examine locally.
Or you can use sqlite3 on a shell (adb shell) to examine it.

Categories

Resources