I’m trying to setup the application server part of C2DM push messaging using this code – https://github.com/lytsing/c2dm-php.
I have completed the app side of things and have registered an email address with Google – every time I run the code (on a server with php/cURL installed) i get the error ‘get auth token error’. It driving me nuts as I’ve no idea where to begin to solve the problem.
The only lines I have changed in the code are – in the s2dm.php file –
'source' => 'com.phonegap.chillimusicapp',
and I added my email/password into the post.php file –
$result = $c2dm->getAuthToken("email@googlemail.com", "password");
Any advice would be great!
Cheers
Paul
Try using below sample code, It is working fine.
FYI! No need to call get_auth_id() every time you send notification, You can call once and store auth_id somewhere in config file also.