Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Titanium push set badge +1 doesnt seem to work

$
0
0

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);
Can someone please help with this?

Thanks


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>