Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

specify dashboard item badge in a push notification call?

Hello folks!

I have a problem understanding how to trigger item.badge in a dashboard view where item is ex: 3!

If the app receives a push notification, how can specify the item to assign it a badge number??

I couldn't really specify which an item index to have the badge on!

Any help is greatly appreciated!

— asked October 21st 2010 by Sam Al
  • item
0 Comments

7 Answers

  • Accepted Answer

    You can see how dashboard item badges are set both at initialization and later in an event listener at http://github.com/appcelerator/KitchenSink/blob/master/KitchenSink/Resources/examples/dashboard.js

    — answered October 28th 2010 by Jonathan Harlap
    permalink
    1 Comment
    • Oh I am so so sorry, I posted the comment, but when I paid a close attention to the example you gave me, I got the solution.
      it was by having the array itself index.

      theDataArray[3].badge = +1;
      

      Thank you very very much! :)

      — commented October 28th 2010 by Sam Al
  • Any help??

    — answered October 23rd 2010 by Sam Al
    permalink
    0 Comments
  • The badge you can set with push notifications is the app badge, not an item in a dashboard. If you want to set a badge on an item in a dashboard you can see how it's done in KitchenSink.

    — answered October 23rd 2010 by Jonathan Harlap
    permalink
    0 Comments
  • Jonathan Harlap, thank you for taking the time to answer my question!
    However, if you have tried the facebook app, you can see the item badge if you receive a private message or something similar!

    There should be an identifier for the item badge in the dashboard view!

    Thank you again!

    — answered October 23rd 2010 by Sam Al
    permalink
    0 Comments
  • Please help me out :)

    — answered October 26th 2010 by Sam Al
    permalink
    0 Comments
  • Jonathan Harlap, thank you again! you're awesome! :)

    Okay, here is the case in a pseudo code:

    If a push notification is successfully received then
       assign a badge of +1 to the item at index 3 
       //where item.index(3) is the item of the app news for example
    end if
    

    where the dashboard will be looking something like

    [ ] [ ] [ ]
    [x] [ ] [ ]
    [ ] [ ] [ ]
    

    where [x] is the app news item which I want to assign it a badge if a push notification is successfully received.

    Thanks again! :)

    — answered October 28th 2010 by Sam Al
    permalink
    0 Comments
  • The answer is (by the help of Jonathan Harlap, many thanks go to him).

    var Data = ["item1", "item2", "item3", ... , "itemN"];
    
    /*
    rest of code goes here
    ...
    ...
    ...
    and then if a successful push notification is received, 
    just do the following for assigning a badge for the 
    "item3", for example!
    */
    
    Data[2].badge = +1;
    

    Thank you Jonathan Harlap :)

    — answered October 28th 2010 by Sam Al
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.