Android App to talk to a web server, download a file and parse - android

I am new to this. I have the Android SDK installed with Eclipse. I can work with basic activities and layouts.
I am looking to write this Android application that will;
1) Allow users to sign-in using a pre-allocated password.
2) Login and change the password.
3) Every time the user opens the app, he downloads a CSV file from a server to the SD card.
4) The app parses from the file and displays them on several activities and small frames inside the app.
Think of it as an informational application. But, I'd like to add some intelligence on top of it after I get this done.
I have read many articles and topics but none of them give me a specific approach to do this faster. I have very little time for development.
If there's a similar application that you're familiar with, I'd like to take a look at the code.
I want to know exactly (the code) on how the communication between the app and a linux based server on the web needs to be established. Right now, there's only a CSV file (or an EXCEL file - which one's better to parse? How to decide?) there.
Also, when the CSV file is up to date, I wouldn't want it to download the file again. How to prevent it?
As I said, I am new - so please be patient.
Thanks

If you are new to this and want to develop something fast, why do it the hardest way, in java? There are so many easy toolkits out there, e.g. RFO.Basic, you will be amazed how much you can achieve, fast, that way.

(You asked several questions) Easiest to parse? If you don't have Excel installed on your Android device, the CSV is of course easier to parse, needing only text tools. However, if you have a choice of formats, why not use XML? If you have never worked with XML, there is a little learning curve, but there are lots of tutorials on the web. After that, you'll never want to go back to CSV.

Your last question: how to prevent download of unchanged file? Is this about a big file? In that case start with quickly downloading the hash (checksum) of the file, so that the client can decide if the file has changed.

Related

Can I upload only template files on google play store?

Looking for a suggestion.
I have uploaded an app on playstore. In that app, I have few templates of questionnaire (xml files - stored in resources).
Client modifies some of the templates once in a month or two.
When client modifies the template, I need to sign and upload APK again.
Is there any way out to upload only the template resources and enable app to read them or something?
Like for media players, themes are uploaded as different package or application, but once downloaded they are part of MediaPlayer.
Thank you!
Currently, as you guessed, the only practical approach is to upload a new APK every time there is new content.
Two ways to solve this:
1. The elegant solution:
If you can re-architect your app to communicate with a web service, you can store your templates there. Once a user installs and runs your app, you can have the app contact the service, authenticate if needed, and download the templates. This can be done once on login or every time the app is run - purely a design decision.
The minimum functionality you need from a web service is an online database. One example is Parse, which is going to discontinue service soon. Another is Firebase, which is free and fairly easy to use. You could store your XML templates in Firebase and have your app download them as needed.
This approach gives the developer control of the template content.
2. The super hacky way
Designate some directory in External Storage (this is important) to store these template files in, and have your app periodically scan this directory for templates to use. When there is a new or updated template, the user downloads the template and then copies it to that specific directory.
Obviously, this plan is full of holes - anything can go wrong here: users not knowing how or where to copy what, misformatted files, etc. And your userbase can have wildly different collections of templates and if something goes wrong, you won't know which templates a particular user has.
So there's the easy and the hard way. Obviously, I recommend the latter, if only for stability and sanity reasons...

Adding a file to Android internal storage at design time

I've been messing around with Android, after having read Android Application Development for Dummies, and nothing else (just to illustrate how little I know) I'm trying to create my first useful, but very simple app.
The app should do the following:
prompt me for a password
read a string (persisted somewhere in the memory)
use my password as a key to decrypt the string
parse the string as xml and display the data to me
other than being a coding exercise, this would serve me as a sneaky way of storing sensitive data that's too copious to remember.
I don't want the app to handle input of this data, I want it to come pre-filled with it. (never mind reusability right now) I don't want to hardcode the string in the code though.
I've decided to store the string in a file in the app's internal storage (if this is a bad idea, feel free to suggest something else). I've found plenty of examples on how to work with these files. But they all deal with creating the file at runtime. What I'd like to do is create the file as part of my Eclipse project, and then have it available to the app at runtime.
Is it possible to do this?
What I'd like to do is create the file as part of my Eclipse project,
and then have it available to the app at runtime. Is it possible to do
this?
Yes it's possible, you can create your file in the assets or res/raw directory, then fill its content when the app is running.
However, I'm not sure if this is the best place if you have sensitive information to store in.

How to handle data in android

Im working on a self-test app.
And I wondering on how to store the data, I've got over 200 questions and more is on the way.
Was thinking of storing them as XML but didnt find a way to get a random question without reading the whole string-array to a variable, which is bad for the memory.
So the correct way to go is to use a SQL-database, right?
But how do I make such a database so that it exists at boot and dont need to be made during start up?
Can't seem to find any tutorial on this subject, on how to handle questionnaires.
Here's a good tutorial on SQLite and Content Provider. It'll introduce you to using SQL databases on Android, and wrapping them into a ContentProvider.
As for how to get the data to the device - you have two options:
You pack the SQLite .db file in the application assets folder. Pros: the database is ready for consumption on the first run of the app. Cons: your .apk is too big. Updating is hard.
You download the data on the first run. Pros: your .apk is slim. updating is easy Cons: there's a delay before the user can use the app.
You ship a small .db file with the first 10 questions. Pros: Your users can start using the app immediately, while you download the rest of the questions in the background. Cons: You have to pick 10 questions you're likely to never or rarely change, or you risk your app to start with outdated data.
Create the db offline and either put it in the apk or download it.

Is XML a good way to organize App data and keep it up to date on the Market?

this should be an easy one for whoever published Android Apps before...
Here is my situation:
I'm trying to develop a "city guide" app and I was wondering if my idea of working with .XML files to structure my data (the client provided a .PDF file with pictures, address, tel. no, websites, opening hours of the different destinations) is the best way to go.
I was hoping to be able to write this app as an "interpreter" for this type of .XML and then easily include other cities or destinations in a city by updating that input XML file.
So this is not a technical question, I know how to pull this off, the question is if this is a good way to go? How do you keep an app easily up to date? Would a altered XML trigger a Market wide update notification ?
My research lead me to believe that this is a comfortable way to update a published Android Market app (prior to this inquiry I consulted:
http://developer.android.com/guide/publishing/publishing.html
All helpful hints and suggestions will be greatly appreciated.
Regards,
Veo.
Once I developed such kind of an app that had to contain the whole information in itself. I structured it in SQLite database that I was shipping along with the application. The file was not directly readable (or at least easy to read) from the assets folder, but every time when the file was altered I copied the sqlite file to the application storage and used it as ordinary application database. The cool thing is that this way I did not have to pay for the parsing of xml every time the application ran.
Several notes here:
My database grew too big and I had to split it in files of 1MB, because this is the limit for a file in the asset folder. For more info see here:
The database update mechanism with the database version still worked well.
When you create the database manually you need to take into account that Android expects one system table to exist in it (it is automatically created if the database is created in Android code). Basically see this answer here for more info on that.

Upload file for primitive chat

I need a fast way to upload files to a ftp server.The files will be used for a primitive chat.Something like a timer and every 5 sec checks to see if the file x was added,if it was added open it and show it.
So please tell me an easy way to upload a file,because from google,I got only hundreds of lines of code.And yes,I need it for a FTP server.
Also it would be awesome to tell me a way to acces a file trough ftp open it and show it.(don't really need to download).
You should use the org.apache.commons.net.ftp.FTPClient library - it's free and implements fairly easily with Android. You can find a pretty easy how-to at the bottom of this blog post:
http://hoang17.com/posts/android/android-how-to-upload-a-file-via-ftp
That article should be especially helpful as it shows you how to store a string as data in a specific filename.
To be honest though - FTP seems like the absolute worst way to create any form of chat communication. :)
Cheers.

Categories

Resources