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 6058833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:38:36+00:00 2026-05-23T08:38:36+00:00

I am trying to send information to a server from an android phone. When

  • 0

I am trying to send information to a server from an android phone.

When the server receives the information it sends back a 1 or a 0 to signify pass or fail. Server-side everything is fine because there in another app for iOS that does the same thing, but it works. Also the sever sends an email anytime it receives a request.

My problem is that it does not seem like the app is contacting the server. When I run the app no response is given back and no email is sent once the Http Post code is executed.

I have the Http Post code below, thank you for any help you can give .

    public void send()
        {
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(site);

            try {
                 // Add your data
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
                nameValuePairs.add(new BasicNameValuePair("dateOfEventStart", startYear + "-" + startMonth + "-" + startDay));
                nameValuePairs.add(new BasicNameValuePair("dateOfEventEnd", endYear + "-" + endMonth + "-" + endDay));
                nameValuePairs.add(new BasicNameValuePair("locationType", locType));
                nameValuePairs.add(new BasicNameValuePair("locationZipCode", location));
                nameValuePairs.add(new BasicNameValuePair("eventType", type));
                nameValuePairs.add(new BasicNameValuePair("groundSurface", groundType));
                nameValuePairs.add(new BasicNameValuePair("numberOfGuests", numGuests + ""));
                nameValuePairs.add(new BasicNameValuePair("seatingArrangments", arrangement));
                nameValuePairs.add(new BasicNameValuePair("accessoriesTables",stuff));
                nameValuePairs.add(new BasicNameValuePair("estimatedArea", tent));
                nameValuePairs.add(new BasicNameValuePair("estimatedRoomToSpare", spared));
                nameValuePairs.add(new BasicNameValuePair("contactName", nameA));
                nameValuePairs.add(new BasicNameValuePair("contactPhone", phoneA));
                nameValuePairs.add(new BasicNameValuePair("contactEmail", addressA));
                nameValuePairs.add(new BasicNameValuePair("contactComments", comment));
                nameValuePairs.add(new BasicNameValuePair("isInternational", isInternational + ""));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = httpclient.execute(httppost);
                responseString = response.toString();


            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
            } catch (IOException e) {
                // TODO Auto-generated catch block
            }

        }

site is variable that was declared earlier on. It is a string that contains location of the form receiver

also below is the information I was given about the server

You will send it a “POST” request with (most likely) a “content-type” of “application/x-www-form-urlencoded”.

The content of the “POST” will be a String that is formatted like a website URL’s “Query >String”. (That’s the stuff after the question mark if you’re not familiar with them.)

In this string, there are keys and values connected by an equal sign. Key/Value pairs are >separated by ampersands (&’s).

Here is an example of a string I used in ASP to test the service if it helps (with >carriage returns added for readability):

strContent = “dateOfEventStart=2011-09-24

&dateOfEventEnd=2011-09-26

&locationType=” & Server.URLEncode(“Residential”) & “

&locationZipCode=38016

&eventType=” & Server.URLEncode(“Corporate Event”) & “

&eventTypeSecondary=

&groundSurface=” & Server.URLEncode(“Gravel (over dirt)”) & “

&groundSurfaceSecondary=

&numberOfGuests=90

&seatingArrangements=” & Server.URLEncode(“Round tables of 6 guests”) & “

&accessoriesTables=” & Server.URLEncode(“Buffet,Cake,Gift,Beverage Station”) & “

&accessoriesEntertainment=

&estimatedArea=” & Server.URLEncode(“1200 sq ft”) & “

&estimatedTentSize=” & Server.URLEncode(“30 ft x 40 ft or 20 ft x 60 ft”) & “

&estimatedRoomToSpare=” & Server.URLEncode(“0 sq ft or 0 sq ft”) & “

&contactName=” & Server.URLEncode(“Jonathan Chan”) & “

&contactPhone=9011234567

&contactEmail=” & Server.URLEncode(“jchan@lunaweb.com”) & “

&contactComments=” & Server.URLEncode(“This is a long comment.”)

In my ASP example, you may have noticed “Server.URLEncode” surrounding Strings. This is >so certain characters that could mess up the data gets encoded into % hexadecimal ASCII >values. For example, if someone enters “I love cheese & cake” as his comment, the program >will think that the ampersand is denoting a new Key/Value pair. If we encode the URL, it >will look like “I%20love%20cheese%20%26%20cake”.

  • 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-05-23T08:38:36+00:00Added an answer on May 23, 2026 at 8:38 am
    1. See what are the errors in the logcat file
    2. Check if you have included the Internet Permission in your manifest file.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to send a picture from a android device to a server and
I'm trying to send information from a form and a hidden email variable (from
I'm working on an android app that has to send and receive information from
I'm trying to send-retrive message from server by SOAP... but soapConnection.call( soapMessage, endpoint )
i'm trying to get information from a remote server on my local machine. readyState
I am trying to send out mails from my server without them getting into
I'm trying to use JSON, I'm getting the information from the server so I've
I am trying to get a Android device to send some information to a
I am trying to send an email from a site I am building, but
I'm trying to send an XMLHttpRequest object to my Rails server but the headers

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.