How to write the text file after received the location? - android

I'm implementing the application just like tracking the user's traveling.
Now I'm using the SQLite database which is record the location, time,and date
then automatically send to the MySQL server via JSON if the Internet is connecting.
But I want to do like the following:
1) I would like to keep data as a text file of each traveling before send to server.
2) I don't know that I should record data in SQLite before write as a file or not?
3) I also need to list all files in the document menu to show user all files
and check the status of all files are completely sent or did not send.
I tried to search for the good tutorial and any examples but did not find them yet.
If anyone have a good tutorial for write/read file and any idea for these, please suggests me.
Thank you so much

Here is good tutorial how to write data to file and save it to SD card.

Related

How to export/import data on Android

I have an application that stores data in SQLite db. I've implemented export of this data to external file (in json format) with custom file extension. Also I have an activity that starts when user opens my file and saves it back to SQLite.
I don't want to backup my db, I'm exporting a part of data to be used by another users.
My next goal is to make sharing this data via Bluetooth (export it to Dropbox / send via email). I want it to look like described in this tutorial: http://developer.android.com/training/sharing/send.html but I doubt that this tutorial is what I need.
I don't want users to export data to file and then send this file via Bluetooth, I want them to share data directly from my app.
I looked at FileProvider. I'm confused with insert, update and other methods so I'm not sure this is the right choise.
I looked at Sending Binary Content tutorial but I don't know how to create intent properly and how to save my temporary file for sharing.
Please, describe the way to share this type of data or give me links to examples. Thanks!
P.S. sorry for my English

How to communicate with xml file in android

My app should have capability to work online and offline.
When I have internet, I will connect to tomcat server and fetching the json object and displaying the details.
But if I don't have internet access, I want my app to work. So my idea was to store the data in xml files in mobile at some folder when my last communication done with server. Is it possible?
If so how can I do it.. Can anybody help me ???
You can store the data in your internal memory and every time you hit the server delete the old contents.
Maybe you can use Preferences or a database

Storing Local Data on Android Phone and then uploading with Google Spreadsheets

I am developing an android application for rural villages where 3g access is not always present. The application will be based out of a Google Spreadsheet. It should be such that if there is no internet access, new data entered will be stored on a local file and when there is internet connection, it will automatically sync with the online file. What is the method to properly proceed with this? Can i store a local excel file or something similar and then sync that file with the online google spreadsheets? Are they even compatible?
Sorry for the many questions but any help will be great!
The usual way to store structured data on Android is to use an sqlite database. Save your data , then just copy it to the Google spreadsheet using the API. If you want to get fancy, you can write a sync adapter and let the OS schedule it for you. Not sure how well that is going to work if connections are unreliable though.
MyTracks is an open source that does something similar, you can use it as a reference: http://code.google.com/p/mytracks/

Android log in and download csv file

I am writing an Android app and I need to download a csv file for a graph. I am not sure if I need to either put the two columns to two array strings or import them to the DB then just query. I am leaning towards just putting them to strings since the csv file will change constantly.
My two issues are:
I need to log into a specific URL to populate the CSV with the correct data such as http://myurl.net/protect/module_graph.htm?log=02. That will populate the file http://myurl.net/protect/data1.csv with the data for the correct item. Changing the log=02 to log=03 or any other number changes the content of the data1.csv file. When I pull up the first URL in a web browser it pops up a window asking for basic authentication. How do I need to call the URL to send the username and password with the request?
I need to get the CSV file downloaded and have the two columns output as strings so the graphing code can just read the data from the strings. I think I know how to download it but should I store it to the SD card and then output the data or just open the file from the web and then output the data? Also how do you tell it to put each column to an arraystring?
Any help is appreciated. Code examples or links to tutorials or other options are much much appreciated :)
Thanks!
You never say it, but I assume you are developing an Android app:
Use HttpClient GET with authentication: an example.
Again use HttpClient GET and look at the reply.

How to transfer SQLite db to web server on android phone

I have an application that creates an SQLite database and saves
information to it over the course of a day. At the end of the day i
want to export this database to a web server.
Could anyone point me in the right direction for this?
Should I use httppost or put. I have researched this myself online but
there seems to be so many different ways to explore. The server side
does not exist yet either. I have access to an apache server so i am
hoping to use that.
Could anyone advise me the best/most simple way to do this?
Thanks guys,
Just wanted to let you know that i used the intent provided by the andFTP app in the end. Its very simple to use and details can be found at: http://www.lysesoft.com/support/forums/viewtopic.php?f=5&t=158
Couple of ways ...
you can ftp up the db each day
you can export the data to a csv file and post it to the server; once there you can then import it into the db on the web server
Is it for backup purposes? Or do you require a number of dbs on the web server?
Do you want this to be an automatic or manual transfer? SQLite data is just a file, so (from the SQLite site)... "If SQLite can read the disk file then it can read anything in the database. If the disk file and its directory are writable, then SQLite can change anything in the database. Database files can easily be copied onto a USB memory stick or emailed for sharing." So (provided everything your app needs is set up on the server) just move the file to the server.

Categories

Resources