WWW::Google::C2DM - Google C2DM Client
use WWW::Google::C2DM; use WWW::Google::ClientLogin; my $auth_token = WWW::Google::ClientLogin->new(...)->authentication->auth_token; my $c2dm = WWW::Google::C2DM->new(auth_token => $auth_token); my $res = $c2dm->send( registration_id => $registration_id, collapse_key => $collapse_key, 'data.message' => $message, ); die $res->error_code if $res->is_error; my $id = $res->id;
WWW::Google::C2DM is HTTP Client for Google C2DM service.
SEE ALSO http://code.google.com/intl/us/android/c2dm/
Create a WWW::Google::C2DM instance.
my $c2dm = WWW::Google::C2DM->new(auth_token => $auth_token);
Supported parameters are:
Required. authorization token from Google ClientLogin. SEE ALSO WWW::Google::ClientLogin.
Optional.
Send to C2DM. Returned values is WWW::Google::C2DM::Response object.
my $res = $c2dm->send( registration_id => $registration_id, collapse_key => $collapse_key, 'data.message' => $message, delay_while_idle => $bool, ); say $res->error_code if $res->is_error;
Required. The registration ID retrieved from the Android application on the phone.
registration_id => $registration_id,
Required. An arbitrary string that is used to collapse a group of like messages when the device is offline, so that only the last message gets sent to the client.
collapse_key => $collapse_key,
Optional. If included, indicates that the message should not be sent immediately if the device is idle.
delay_while_idle => 1,
Optional. Payload data, expressed as key-value pairs.
my $res = $c2dm->send( .... 'data.message' => $message, 'data.name' => $name, );
Or you can specify data. Value is must be HASHREF.
data
data => { message => $message, name => $name, }, # Equals: # 'data.message' => $message, # 'data.name' => $name,
Or you can specify both option.
SEE ALSO http://code.google.com/intl/us/android/c2dm/#push
xaicron <xaicron@cpan.org>
Copyright 2011 - xaicron
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Google::C2DM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Google::C2DM
CPAN shell
perl -MCPAN -e shell install WWW::Google::C2DM
For more information on module installation, please visit the detailed CPAN module installation guide.