Import Android SQLite database with Java desktop program - java

For the program I am developing, I need for a Java application to be able to access a database stored in the android /data/data/package/databases folder. Is there any way that this could be done automatically, or the database has to be imported manually ?
Thanks in advance for your answers.

My investigation lead to the conclusion that one cannot access the /data directory in Android. So, my solution to the problem will be (because I still have not implemented it) to store the database in the SDCard and then access it from the Java application (which I believe will be straightforward).

Related

access gps location from java on windows

I'm trying to retrieve the most accurate geolocation of a user, which is using a java app and i haven't found anyway to access the location property, i've seen apps on the store doing it but i want to do it from a java app
what i have tried is creating a UWP class lib with visual studio and putting static methods inside, and then i thought of using jni4net to invoke it from java but i wasn't able to compile the dll
isn't there anyway to interact with the windows runtime from java, and how would i access the gps location by any other way
after lots of researches, i have found something that answers my needs but is not a perfect solution.
i have created a C# console app and had it retrieves the geolocation using the System.Device.Location API and prints it to the console, and then compiled it into an exe and packed the exe with my libs.
the java app runs the exe and gets its output and uses it as it pleases, the only problem is that the C# console app can't enable the lcoation so if the location is off the user will have to enable it manually, i hope this approach helps someone.

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.

How to debug a db4o database running on an Android app

I have an Android app that uses a db4o database, and I would like to query this database while running my application. I have already installed OME (ObjectManager Enterprise) plugin on Eclipse, but I don't know how to connect it to my Android db4o database.
Has anyone been able to do this successfully? I'm not even sure if there is a way to access my Android app's data while the program is running.
I am afraid, there is no direct way to do this. You have to copy database from your android emulator to your machine and then query the db using OME
http://tracker.db4o.com/browse/OMJ-184
i am using "db4o object manager 7.4". you can download https://code.google.com/p/db4o-om/downloads/detail?name=%24objectmanager-%207.4-java.zip&can=2&q=

How to read database of another application

I am working on a rooted device.
I have connected with the adb shell from my pc and I can verify that the other database exists and I can query its tables.
However in the my java code when I try to open the database I get error
android.database.sqlite.SQLiteException: unable to open database file
I am trying to open the database like this:
SQLiteDatabase.openDatabase(PATH, null, SQLiteDatabase.OPEN_READONLY);
The path is something like /data/data/com.xxx.xxx/databases/xx.db
Am I supposed to read the databases of other applications like this or there is another way?
UPDATE:
I also tried making the system app as adviced in this thread Push my apk to /system/app
I think it works because the app cannot be uninstalled after that from the applications manager like the ordinary apps so I think it is a system app. But still I cannot access the database though I am sure the paths and permissions are ok.
Android OS by default does not allow applications to access each others private folders. To be able to read files that are in another applications folder either:
1) you need to have both applications installed using same user id. Add this to both manifests:
android:sharedUserId="com.xx.xx"
2) If other app is a 3rd party app then your only choice is to install your app as system application. To do that you need a rooted phone and you need to mount the system folder. And then you need to put your application into /system/app/ folder and reboot the phone. It should be installed automatically during the boot.
I would assume that the permissions on the database files are set such that your application has no acess. Even if your device is rooted it doesn't mean that your application is running as root.
This is because the app needs root, and needs to change the permissions of the database you are trying to access so that you can actually access it. What you will need to do is, as root, change the permissions of the database so that everyone can access it, do what you would like on the database, close the database and change the permissions back.
This does circumvent security of android, so proceed at your own risk. You can find a code sample at:
http://rratmansky.wordpress.com/?p=259&preview=true

Android Application files similar to .cod and .jad file in Blackberry

I have a Blackberry application which contains .jad, .cod files and the velocity file .vm get automatically created. Now I want to use same application with Android. So which files are needed?
I am currently using Simulator 2.2 on Windows XP.
Again I am facing one problem that the browser URL size is too small. So I am using Bitly to shorten the URL. Again I can not copy and Paste the URL?
Does anybody know a solution for this?
A J2ME BlackBerry application has nothing to do with an Android Java application. You have to start from scratch using Android SDK and re-write the application.
BTW: Please ask only one question at a time.

Categories

Resources