Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-1168

Titanium push set badge +1 doesnt seem to work

    Details

      Description

      Hi All,
      I have been trying to get push notifications to work for a while now everything is nearly there but i cannot seem to get the push badge to increment 1 on the application badge.
      I am sending the payload like this.
      ~~~

      {"alert":"This is a push message","badge": "+1","category": "sampleCategory","title":"Sending push","vibrate":true,"sound":"beep"}

      ~~~
      The above does not work for me i can minus and it will work fine.
      ~~~

      {"alert":"This is a push message","badge": "-1","category": "sampleCategory","title":"Sending push","vibrate":true,"sound":"beep"}

      ~~~
      Full php code.
      ~~~
      $username = "username_here";
      $password = "password";
      $channel = 'my_channel';
      $title = "No Android";
      $tmp_fname = 'cookie.txt';
      $json = '

      {"alert":"This is a push message","badge": "+1","category": "sampleCategory","title":"' . $title . '","vibrate":true,"sound":"beep"}

      ';

      /*** PUSH NOTIFICATION ***********************************/

      $post_array = array(
      'login' => $username,
      'password' => $password
      );

      /*** INIT CURL *******************************************/
      $curlObj = curl_init();
      $c_opt = array(
      CURLOPT_URL => 'https://api.cloud.appcelerator.com/v1/users/login.json?key=' . $key,
      CURLOPT_COOKIEJAR => $tmp_fname,
      CURLOPT_COOKIEFILE => $tmp_fname,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_POST => 1,
      CURLOPT_POSTFIELDS => "login=" . $username . "&password=" . $password,
      CURLOPT_FOLLOWLOCATION => 0,
      CURLOPT_TIMEOUT => 60
      );

      /*** LOGIN **********************************************/
      curl_setopt_array($curlObj, $c_opt);
      $session = curl_exec($curlObj);

      /*** SEND PUSH ******************************************/
      $c_opt[CURLOPT_URL] = "https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=" . $key;
      $c_opt[CURLOPT_POSTFIELDS] = "channel=" . $channel . "&payload=" . $json . "&to_ids=everyone";

      curl_setopt_array($curlObj, $c_opt);
      $session = curl_exec($curlObj);

      echo $session;

      curl_close($curlObj);
      ~~~

        Attachments

          Activity

            People

            • Assignee:
              sliang Shuo Liang
              Reporter:
              samueleast Samuel East
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Integration