Android 401 for c2dm
<p>I got <code>registration_id</code> and <code>authoCode</code> using same gmail id but still I'm getting "Unauthorized". I am clueless now what can be wrong. </p>

<p>While Sign Up for Android Cloud to Device Messaging. If I'm using abc@gmail.com, I am using same abc@gmail.com in </p>

<pre><code>Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
registrationIntent.putExtra("sender", "abc@gmail.com");
this.startService(registrationIntent);
</code></pre>

<p>same for the while getting authCode</p>

<pre><code>https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&amp;Email=abc@gmail.com&amp;Passwd=XXXXX&amp;source=XXXXXXX-0.1&amp;service=cl
</code></pre>

<p>Code I am using is </p>

<pre><code>$headers = array('Authorization: GoogleLogin auth=' . $authCode);
$data = array(
    'registration_id' =&gt; $registrationId,
    'collapse_key' =&gt; "test",
    'data.message' =&gt; "wass up" //TODO Add more params with just simple data instead
);

print_r($headers);
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://android.apis.google.com/c2dm/send");
if ($headers)
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

curl_close($ch);
echo($response);
return $response;
</code></pre>

<p>These are the steps I followed</p>

<ol>
<li>I created a new google account for my app</li>
<li>Registered it with <a href="http://code.google.com/android/c2dm/signup.html" rel="nofollow">http://code.google.com/android/c2dm/signup.html</a></li>
<li>First ran the app on the simulator to get the registration id </li>
<li>Used the same gmail id to get the authCode </li>
<li>After getting authCode and RegistartionId, I am trying to send the message. </li>
</ol>

<p>Am I missing any steps?</p>
