The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::AppNotifications - send notifications to your iPhone.

SYNOPSIS

  $notifier = Net::AppNotifications->new(
      email    => $registered_email,
      password => $password,
  );

  # - or, prefered -

  $notifier = Net::AppNotifications->new(
      key => $key,
  );

  ## Synchronous blocking notification
  if ($notifier->send("Hello, Mr Jobs")) {
      print "Notification delivered";
  }

  ## Asynchronous non-blocking notification
  my $sent = AnyEvent->condvar;
  my $handle = $notifier->send(
    message               => "Hello!",  # shows up in the notification
    long_message          => "<b>html allowed</b>",    # in the iPhone app
    long_message_preview  => "the notif preview",      # in the iPhone app
    title                 => "the notification title", # in the iPhone app
    sound                 => 2,       # override default audible bell
    silent                => 0,       # if true, make sure there is no bell
    message_level         => -2,      # priority ([-2, 2])
    action_loc_key        => "Approve me", # button on the notification

    # what happened when clicked
    run_command  => "http://maps.google.com/maps?q=cupertino",

    ## delivery callbacks
    on_error   => $error_cb,
    on_timeout => $timeout_cb,
    on_success => sub { $sent->send },
  );
  $sent->recv;

  ## returns undef in case of error
  $key = Net::AppNotifications->get_key(
    email => $registered_email,
    password => $password,
  );

DESCRIPTION

Net::AppNotifications is a wrapper around appnotifications.com. It allows you to push notifications to your iPhone(s) registered with the service.

A visual and audible alert (like for SMS) will arrive on your device in a limited timeframe.

appnotifications allows you to tweak different aspect of the notification received:

  • the message

  • the sound played, if any

  • the title of the accept button of the notification

  • what happens once accepted

  • ... more, see the SYNOPSIS

If you already have an APNS key, I recommend using AnyEvent::APNS, directly.

AUTHOR

Yann Kerherve <yannk@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

AnyEvent::APNS, http://www.appnotifications.com