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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:54:23+00:00 2026-05-30T00:54:23+00:00

I have implemented a C2DM client that requests the registration id from C2DM server.

  • 0

I have implemented a C2DM client that requests the registration id from C2DM server. Once application gets registration id, applications stores device id and registration id in server database. I have implemented a PHP Server, but when ever i try to post message i get Error=MissingRegistration.

PHP Server Code

 $url = 'https://www.google.com/accounts/ClientLogin';

$body = 'Email=senderid@gmail.com&Passwd=password&accountType=GOOGLE&source=MyLittleExample&service=ac2dm';
$c = curl_init ($url);
curl_setopt ($c, CURLOPT_POST, true);
curl_setopt ($c, CURLOPT_POSTFIELDS, $body);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec ($c);
$p = explode("Auth=",$page);
curl_close ($c);

$url = 'https://android.apis.google.com/c2dm/send';

$param = // Get Registration id from my sql
$mtype = 'important';
$msg = 'Hello';

$len = strlen($param);
echo $len;
function sendMessageToPhone($authCode, $deviceRegistrationId, $msgType, $messageText) {

        $headers = array('Content-length:300','Authorization: GoogleLogin auth='.$authCode );
        $data = array(
            'registration_id' => $deviceRegistrationId,
            'collapse_key' => $msgType,
            'data.message' => $messageText //TODO Add more params with just simple data instead           
        );

        $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);
        return $response;
    }
$data = sendMessageToPhone($p[1],$param,$mtype,$msg);
var_dump($data);

According to the document Error=MissingRegistration occurs if there is no registration_id parameter in Post request. I even tried to run application by hard coding the Registration Id. Any help greatly appreciated. Thank You.

  • 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-30T00:54:25+00:00Added an answer on May 30, 2026 at 12:54 am

    Aha! And here comes the possible solution (taking from a thread regarding notifications from another language I do not know): https://stackoverflow.com/a/8339611/1108032. Please read what he stated solved his issue. For me it looks like something like that should be failing you, because code-wise your code seems ok.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented c2dm and it works fine that the device receives the message
I have implemented SQL Server session mode for an asp.net application. <sessionState mode=SQLServer compressionEnabled=true
I have implemented an eclipse plugin that it launches a java application when the
i have implemented a code that fetch single image from 1000+ images. The image
I have implemented C2DM in one of the applications and its working properly. Sometimes,
I have implemented PushNotification Using C2dm. I am getting notification from c2dm also. My
I have implemented ADFS authentication for an asp.net 4.0 application. I have hosted the
I have implemented a custom trace listener (derived from TextWriteTraceListener ) and now I
I have implemented my own RingBuffer , but I'm surprised to see that .NET
I just figured out how to implement android c2dm client but on the server

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.