WordPress.org

Forums

EasyAPNs
increment Badge (2 posts)

  1. piersoft
    Member
    Posted 3 years ago #

    hi,

    in easyapns project, i found autoincrement count for badge.
    But in this plug in, the message sent to device it's only for 1.

    So even if app it's closed, the badge number it's always 1 and don't increment.

    bug o feature?

    thanks

    http://wordpress.org/extend/plugins/easyapns/

  2. piersoft
    Member
    Posted 3 years ago #

    i've used:

    /**
    * Increment Message Badge
    *
    *
    * <?php
    * $db = new DbConnect();
    * $db->show_errors();
    * $apns = new APNS($db);
    * $apns->newMessage(1, '2010-01-01 00:00:00');
    * $apns->incrementMessageBadge(1); // HAS TO BE A NUMBER
    * $apns->queueMessage();
    * ?>
    *

    *
    * @param int $number
    * @access public
    */
    public function incrementMessageBadge($number=NULL){
    if(!$this->message) $this->_triggerError('Must use newMessage() before calling this method.', E_USER_ERROR);
    if($number) {
    $sql = "SELECT apns_messages.message FROM apns_messages INNER JOIN apns_devices ON apns_messages.fk_device = apns_devices.pid AND apns_devices.modified < apns_messages.modified WHERE apns_devices.pid = '{$this->message['send']['to']}' ORDER BY `a$
    if($result = $this->db->query($sql)) {
    if($result->num_rows) {
    while($row = $result->fetch_array(MYSQLI_ASSOC)) {
    $last_message = json_decode($row['message']);
    }
    }
    }
    if(isset($last_message)) {
    $number += (int)$last_message->aps->badge;
    }
    if(isset($this->message['aps']['badge'])) $this->_triggerError('Message Badge has already been created. Overwriting with '.$number.'.');
    $this->message['aps']['badge'] = (int)$number;
    }
    }

    with ".$wpdb->prefix." before .apsXXX and in apns.php i've substituted addMessageBadge(1) with incrementMessageBadge(1) but don't works!!

    please helpme

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • EasyAPNs
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags