Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:48:14+00:00 2026-06-01T21:48:14+00:00

I am sending a usage log such as button click or page navigation to

  • 0

I am sending a usage log such as button click or page navigation to my server via http post, Right now i am using the asynctask doInBackground, but my doInBackground method will not be finish until server respond.

Question is: Is there a better to just send the http post and ignore the response from server. But I need to make sure the server records the log.

private static class Async extends AsyncTask<Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... params) {
        String url = "server url";
        DefaultHttpClient httpclient = new DefaultHttpClient();
        httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("username", "password"));
        HttpPost httppost = new HttpPost(url);
        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("DeviceOS", "Android"));
            nameValuePairs.add(new BasicNameValuePair("OSVersion", osVersion));
            nameValuePairs.add(new BasicNameValuePair("DeviceManufacturer", manufacturer));
            nameValuePairs.add(new BasicNameValuePair("Model", model));
            // and some more
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            // Execute HTTP Post Request
            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            String responseBody = httpclient.execute(httppost, responseHandler);

        } catch (ClientProtocolException e) {
            // Error msg will be here = e.getMessage();
        } catch (IOException e) {
            // Error msg will be here = e.getMessage();
        }
        return null;
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:48:16+00:00Added an answer on June 1, 2026 at 9:48 pm

    try this..

    Thread r = new Thread(){
    public void run(){
      //post request
    }
    
    }.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When sending data via POST or GET with jQuery you use for format {
I'm having trouble posting json to a little node.js http server. Post data always
sending mail along with embedded image using asp.net I have already used following but
Sending Email in Android using JavaMail API without using the default/built-in app I'm trying
When sending email using the SMTPClient class in ASP.NET C#, how can I add
For sending HTML document information such as content-encoding , charset , date , last-modified
For sending the same message to 100 devices via c2dm, We need to do
I have some problems sending mails through SMTP using Spring's MailSender interface and the
Is there anyone using git in such a fashion? I would like to distribute
I have a public server(configured with indy 10) . some unknown clients are sending

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.