1

I create an application of user registration. When user registers in the application, I want to save the user data on an HTTP server. How can I do this?

1 Answer 1

3

You can store data on a remote server using networking. One example in this article.

Example of how to store a file on a remote server (from the article above):

File f = new File("/path/fileToUpload.txt");
HttpRequest request = new HttpRequest("http://host/some_path");
Part[] parts = { 
    new StringPart("param_name", "value"), 
    new FilePart(f.getName(), f) 
};
filePost.setEntity( new MultipartRequestEntity(parts, filePost.getParams()) );
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
Sign up to request clarification or add additional context in comments.

4 Comments

this answer is really helpful...But what about sending data to SQLite database by HTTP?
I did not try it. Hopefully it will work. Whether I have to store all the record to a File before sending it to the HTTP Server???
@Paresh Mayani: There are already paid apps for storing on SQL-servers: androlib.com/android.application.com-quickdb-Fp.aspx. To build your own solution take a look at java.net: developer.android.com/reference/java/net/package-summary.html and android.net developer.android.com/reference/android/net/…. In my view, a remote SQLite is a bit odd. SQLite is a tiny DBMS having its primary use in limited environments. Remote storage is better (and faster) with MySQL- or MS SQL-server. Hope this helps! Sincerely,
@Deepak: Not necessary. Your app should be used by more than one user, and each user than should transfer her/his own file to your remote server. Another way is to use a database (see comment above). Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.