I have been trying to pull out my SQLite database from my android application onto my computer.
I only get results, when I run my application on the eclipse android emulator and then I can access to the DB. But the thing is using the emulator is to slow and it doesn't have all the data I have been storing on my app on the cellphone.
I have been googling that for a day and all I can see is "use the emulator".
Isn't it possible without the emulator ?
On commercially released Android devices, you aren't allowed access to your app's internal SQLite database (for security reasons). Thus, if you simply can't stand the emulator, or if you just want to test your app on an actual device to make sure it works properly, there are two options to consider.
Root your device. This will give you access to the /data folder where your app's internal SQLite database is stored.
Use a 3rd party library to write the contents of your database to the SD card. This is a nice workaround if you don't want to bother rooting your device. Check this post for one such implementation.
The SQLite database in your app is just a file. You can use the DDMS file view in Eclipse to pull the file off your device, but only if you have a rooted or development device, or if you're using the emulator.
Once youve got the file on your computer you'll be able to run queries against it using the sqlite3 command (which, depending on your system, you may have to install).
Related
I have to build an app for both android and ios. Among other things, the app provides cloud storage. Now, for ios I have implemented NSFileProviderExtension without providing a ui (basically letting the system handle it), and I can access and manage the cloud by entering the files app, selecting my app and then doing whatever needs to be done.
Now, I searched far and wide for an equivalent for this on android. I have a samsung phone, and when I enter the files app, under the cloud section I can see samsung cloud drive, google drive etc. , and I can manage files there just like I can in my app. But I have no idea what kind of provider I need to implement to achieve this. I have implemented DocumentsProvider, as it seemed to be the most likely candidate, but that doesn't appear in the files app.
I had the same question. My document provider is available in the stock Google "Files" file manager, and all non Samsung apps showing the system file picker but not in "My Files" on Samsung Galaxy phones.
The easiest way to check if your Document Manager working is to attach a file to Gmail (surely on an Android device with your provider installed).
So, hey Samsung! We need you adhering to the Android SAF too a.s.a.p.!
I wrote some classes for my Android-program and it runs. However it takes too much ram because the data in the File is not in a nice form to be processed by the application. Let's call the File Foo.txt for now.
I now want to save the data from Foo.txt in a different form which lets my Android specific code (specific in the sense that it uses Activities, Context etc) do easily since I have all the code for it already, and then load from this data manipulatedFooFile.txt instead. Problem is, I don't know if it's possible at all to save to a file which I can then later retrieve on the desktop, either in an emulator or via a device connected to an USB or a way I don't know of yet. This way I can replace Foo.txt with manipulatedFooFile.txt which would let me use less ram and space on disk.
I know that one other solution would be to remove the code from android and put it into a normal java program. Put that would take a bit of struggle since I have to remove all the dependencies on code that is not there, or start with nothing and write big parts of the code again.
Files and folders can be sent to and from your android device using adb (or android debug bridge).
Using the adb pull command under the syntax adb pull <remote> <local> you are able to transfer a file from the filesystem of the connected android device to your local device (your computer).
From the official documentation for adb pull:
Copies a specified file from an emulator/device instance to your development computer.
Similarly, adb push allows you to push a file from your local computer to the target emulator/android device under the syntax adb push <local> <remote>.
I am using the BackupManager to backup SharedPreferences to the cloud. Now this works as expected when I use it on a single device and only perform a reinstall not a full uninstall. To do that I am clearing data which wipes prefs and than reinstalling the app from eclipse. If I first uninstall the app and after reinstall it the restore call reports no data to restore. The same happens when I install the app on another device.
From my understanding I would expect the data to be restored to any device regardless of the app being reinstalled or being a fresh install. Let me know if posting code will help but I figured that because it is working I might just have misunderstood what the service should be used for and how it works. I am trying to backup a users settings and possibly some information they enter into search fields. I would like this data to follow the user to a new device or if the user uninstalls the app and reinstalls at a later date. Please let me know if BackupManager is not the correct tool to accomplish this.
As I know from the words of Android Advocate:
Generally it seems that BackupManager is only reliable for backing
up app data that will later be restored on the same device if the app
is re-installed from the Play Store.
If you want to do backup syncing across multiple devices then you can try to use Google Drive API, not BackupManager, and that there is very useful session from Google I/O 2012 on the subject.
I am writing an application that will allow an android phone and java application on the computer to communicate over the USB cable. Using Bluetooth or Wifi is not an option in this case.
I found it very difficult to find a nice solution to this problem, and the Host/Accessory libariries seemed designed to hook the phone up to docks/cameras/circuitboards rather than simply a PC. This is my solution, let me know if there are better alternatives:
I'm going to create a Java application to use ADB to push files onto the phone, the phone will then check those files for changes and act accordingly.
It seems to work well so far, except I am using the /sdcard/ folder to hold these files. I want this app to work on phones without SD cards too, so I want to know if there is some other safe folder that I can count on being able to access from the PC with ADB and the android app as well.
(I have looked at INTERNAL STORAGE libraries, but I don't know where they store their data and if I can push/pull with them from ADB.)
Thanks in advance for any help!
Read this https://groups.google.com/forum/?fromgroups#!topic/android-developers/tZrxqZQLh98
Nice discussion about holding tmp files.
Do u want to control your application from PC? Cant you use Intents launched by ADB for that?
Another options port forwarding over USB with ADB:
adb forward tcp:6100 tcp:7100
adb forward tcp:6100 local:logd
Personally I end-up doing GET requests to my local Apache server to fetch data.
Or on rooted device many folders become available.
I'm pretty new to android so apologies if I'm missing an obvious solution, I'm developing an android app that would be used to record various data including photographs and hopefully the intention would be for this collected data to be uploaded to a desktop application where certain desktop specific jobs could be carried out.
Due to the fact I intend to save photographs within the app in the SQLite database as a bytearray which recorded information would be I think that it would be too data intensive to send to a server, plus I wouldn't want the desktop app to necessarily be on a server, it should be standalone. I'd prefer to use the USB connection and allow a USB upload of the data from the app sqlite db direct to the database on the pc, probably sql server. What would be the best way to approach this? Could the android ADB be used to acheive this?
Any help or suggestions on this would be much appreciated.
Regards
I believe that your sqllite database (as well as photos contained there) will be stored on the SD card of the device. You have to options here, first, when your desktop applications find the folder on the device SD card (should be mounted on the filesystem after connecting the device to your PC), second is to use bluetooth and initialize the transfer from the device to your desktop application.
You could try having them on the same network and having them interact that way. I know applications such as RemoteDroid do this, but I have no experience doing so myself. There is also the fact that there is the data saved on the sd card / by putting your device in Storage mode and you could just point your desktop to the device drive and assume a designated folder your app uses exists.
Adding on to the answers here, you could save your photos as files in your sd card and transfer it to your pc from there.
Here is a dev guide on storing files.
Another way is to transfer over WiFi. Ice cream sandwich seems to have a WiFi Direct api that allows us to perform P2P transfers over WiFi. I have not used it yet but have a look at this
Solution 1
I would probably use rsync between my desktop and android. This way you can export data from your sqlite to a flat file and import it to your local database on your desktop. This way you can also put your schema into a file.
RSync is a very stable protocol to exchange files.
Solution 2
You can also use Amazon S3 for this purpose. The file name can contain the version number for ensuring that you have the latest file.