Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid c2dm 302 Http error
    primarykey
    data
    text
    <p>everytime i want to send a push notification to my cell i get the 302 Moved Error from the Google servers. It says, it moved to www.google.com. This doesn't seem correct. So i have the following information:</p> <ul> <li>I am sitting behind a proxy, but i tried this also without a proxy. No effect.</li> <li>CUrl commandline method works fine</li> <li>Receiving the auth token from the Google servers works fine</li> <li>Changing the auth token i want to send has no real effect (changing the last 3-4 characters)</li> <li>Sending no registration id has no effect</li> </ul> <p>Here is the code, that sends a push notification:</p> <pre><code>QString headerStr = QString("GoogleLogin auth=") + m_authCode; qDebug(qPrintable(headerStr)); QUrl url; url.addQueryItem("registration_id", m_pRegCode-&gt;text()); url.addQueryItem("collapse_key", "0"); url.addQueryItem("data.message", "data"); qDebug("%s", qPrintable(url.toString())); qDebug("%s", qPrintable(QString(url.encodedQuery()))); QByteArray data; data = url.encodedQuery(); QUrl header("https://android.apis.google.com/c2dm/send"); QNetworkRequest req(header); req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded;charset=UTF-8"); req.setHeader(QNetworkRequest::ContentLengthHeader, data.length()); req.setRawHeader(QByteArray("Authorization"), headerStr.toAscii()); qDebug("%s", qPrintable(req.url().toString())); m_pPushRep = m_pManager-&gt;post(req, data); </code></pre> <p>The answer i receive is:</p> <pre><code>&lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt; &lt;TITLE&gt;302 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt; &lt;H1&gt;302 Moved&lt;/H1&gt; The document has moved &lt;A HREF="http://www.google.com"&gt;here&lt;/A&gt;. &lt;/BODY&gt;&lt;/HTML&gt; </code></pre> <p>What am i doing wrong?</p> <p>Edit: The solution was actually pretty simple: I had a whitespace at the end of my authentication id. This actually led to the errorcode. So for everyone who reads this in the far future: CHECK YOUR AUTHENTICATION CODE!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload