Net::APNS::Feedback - Retrieve data from Apple's APNS feedback service
use Net::APNS::Feedback; my $apns = Net::APNS::Feedback->new({ sandbox => 1, cert => 'cert.pem', key => 'key.pem', passwd => 'key password', }); my @feedback = $apns->retrieve_feedback;
Apple's APNS system provides a feedback service to let you know the device rejected notifications because they are no longer wanted (usually meaning the app has been removed).
See the Apple Push Notification Service Programming Guide.
Args:
set to true if you want to use the sandbox host. defaults to 0. ignored if you set the host manually
path to your certificate
defaults to PEM - see Net::SSLeay.
path you your private key
password for your private key, if required.
defaults to feedback.push.apple.com or feedback.sandbox.push.apple.com depending on the setting of sandbox. can be set manually.
defaults to 2196
NB: all these args are available as accessors, but you need to set them before the connection is first used.
Takes no arguments and returns an arrayref (possibly) containing hashrefs. eg:
[ { 'time_t' => 1259577923, 'token' => '04ef31c86205...624f390ea878416' }, { 'time_t' => 1259577926, 'token' => '04ef31c86205...624f390ea878416' }, ]
time_t is the epoc time of when the notification was rejected. token is a hex encoded device token for you to reconcile with your data.
time_t
token
As you can see from this example, you can recieve more than one notifications about the same token if you have had more than one message rejected since you last checked the feedback service.
Note that once you have drained all the feedback, you will not be delivered the same set again.
Disconnect the ssl connection and socket, and free the ssl structures. This usually isn't necessary as this will happen implicitly when the object is destroyed.
http://mark.aufflick.com/talks/apns
http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
http://github.com/aufflick/p5-net-apns-persistent
Mark Aufflick, <mark@aufflick.com>, http://mark.aufflick.com/
Copyright (C) 2009 by Mark Aufflick
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.9 or, at your option, any later version of Perl 5 you may have available.
To install Net::APNS::Persistent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::APNS::Persistent
CPAN shell
perl -MCPAN -e shell install Net::APNS::Persistent
For more information on module installation, please visit the detailed CPAN module installation guide.