views:

160

answers:

1

On my web server I will be creating a bespoke XML file for a client app to access. This means I must authenticate the client and then give the client the XML file.

I believe the client application will need to post data (login, password) to the server and once a connection is established, it will receive the XML file from the server (most likely PHP).

If you have any advise it would be most welcomed. Particular classes to look at and any potential dangers.

I have found something relevant in C Sharp, however I am limited to Java as the app will be for Android.

+2  A: 

Android lets you pull in external jar's, so I would use HttpClient for performing your POST operation with login info.((EDIT: Per Samuh in the comments, this is already a part of the android SDK, no need to include the external version))

Once you have the XML data in your application, you can parse it however you see fit. I would create a SQLite database for your application to store the data parsed in from the XML file. Then, when you run your app, (or the user clicks refresh), pull the XML file down, populate the SQLite DB with the data from it, and hook the UI controls to the database as done in the Notepad tutorial

The advantages of this setup are that you can always have a local copy to show the user if they are offline, and the user can quit, pause, or leave the app open or closed and not lose the information. You should implement both a refresh on demand and a regular refresh with Alarm's setInexactRepeating() so the application will update automatically in the background in a battery life maintaining way.

That should be enough to get you started.

Dinedal
you don't need to put external Jars in your project for HttpClient et al.classes; the android.jar already contains these.
Samuh
@Samuh You are correct, my mistake. Makes it even easier.
Dinedal