title: How to send C2DM Registration ID to server
body: <p>I've scoured the internet for a while now and I cannot get my Android app to send the registration ID and device ID to the server. I'm sure there is something simple that I am missing, but can anyone see what I am doing wrong? The code is hit and the Toasts are shown, but the server doesn't do anything, but if I go to the URL directly, it does what I want it to.</p>
  
  <pre><code>if (!regId.equals("")) {
          Toast.makeText(context, "The registration ID is: " + regId,
                  Toast.LENGTH_LONG).show();
          Toast.makeText(context, "The device ID is: " + deviceId,
                  Toast.LENGTH_LONG).show();
          // Create a new HttpClient and Post Header
          HttpClient httpclient = new DefaultHttpClient();
          HttpPost httppost = new HttpPost("http://uni.britintel.co.uk/register.php");
  
          try {
              // Add your data
              List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1);
              nameValuePairs.add(new BasicNameValuePair("deviceId", deviceId));
              nameValuePairs.add(new BasicNameValuePair("registrationId", regId));
              httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
              // Execute HTTP Post Request
              HttpResponse httpresponse = httpclient.execute(httppost);
              BufferedReader rd = new BufferedReader(new InputStreamReader(
                      httpresponse.getEntity().getContent()));
  
              String line = "";
              while ((line = rd.readLine()) != null) {
                  Log.e("HttpResponse", line);
                  Toast.makeText(context, line,
                          Toast.LENGTH_LONG).show();
              }
  
  
          } catch (ClientProtocolException e) {
              // TODO Auto-generated catch block
          } catch (IOException e) {
              // TODO Auto-generated catch block
          }
      } else {
          Toast.makeText(context, "The registration ID doesn't exist",
                  Toast.LENGTH_LONG).show();
      }
  </code></pre>
  
  <p>The buffered reader will be removed once I get it working as it is pointless for what I want.</p>
  
  <p>Thank you in advance for any help.</p>