Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 31
Registered: ‎03-15-2013
My Device: 9320
My Carrier: Telkomsel

Re: Blackberry Notification Bar: How to replace Message Preview Window

@rakeshmjiyani

Create a timer in your application and call below code every 10sec

 

    public DemoMessageAddNotification()
    {       
        setTitle("Title");
        ApplicationMessageFolder folder = null;
        ApplicationDescriptor appDescr = ApplicationDescriptor.currentApplicationDescriptor();
        ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
        ApplicationFolderIntegrationConfig config = new ApplicationFolderIntegrationConfig(true, true, appDescr);

 

// check whether your folder is empty or not
        if(ApplicationMessageFolderRegistry.getInstance().getApplicationFolder(0x33c7ce29883abe5fL)==null)
        {
        folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(0x33c7ce29883abe5fL, "Test Folder", new ReadableListImpl(),config );
        }
        else
        {
        folder = ApplicationMessageFolderRegistry.getInstance().getApplicationFolder(0x33c7ce29883abe5fL);
        }

        ReadableListImpl mylist= new ReadableListImpl();
        MyMessage msg = new MyMessage("me@here.com", "Pizza Toppings","What would you like on your pizza?", System.currentTimeMillis());
        mylist.addMessage(msg);

        folder.fireElementAdded(msg,true);
        System.out.println("nr of messages"+folder.hasNewMessages());

        EncodedImage image = EncodedImage.getEncodedImageResource("icon.png" );
        ApplicationIcon icon = new ApplicationIcon( image );
        ApplicationIndicatorRegistry ireg = ApplicationIndicatorRegistry.getInstance();
        ApplicationIndicator indicator = ireg.register(icon, false, true);
        indicator.setNotificationState(true);

        indicator.setIcon(icon);
        indicator.setValue(indicator.getValue() + 1);
        indicator.setVisible(true);    
      }

it will give you new message in your folder

Regular Contributor
Posts: 66
Registered: ‎08-28-2010
My Device: 9630

Re: Blackberry Notification Bar: How to replace Message Preview Window

Thanks ...

 

Finally it works with checking the exists of applicationmessage folder...

 

now i get the message everytime when i want....

 

I one one more question but is regarding another service of blackberry can i ask it here ??

 

Regards,

Contributor
Posts: 31
Registered: ‎03-15-2013
My Device: 9320
My Carrier: Telkomsel

Re: Blackberry Notification Bar: How to replace Message Preview Window

Ooow Glad to hear that, actually it is better to create a new thread to post your question, you can accept solution and share it with anyone else that has the same problem

Developer
Posts: 226
Registered: ‎10-01-2011
My Device: Passport

Re: Blackberry Notification Bar: How to replace Message Preview Window

[ Edited ]

Guys like I said in my earlier message, don't put the folder registration and indicator stuff in your screen, put it in your app.

 

Since the original question has been solved, correct etiquette is to create a new topic for a new quesiton

Contributor
Posts: 31
Registered: ‎03-15-2013
My Device: 9320
My Carrier: Telkomsel

Re: Blackberry Notification Bar: How to replace Message Preview Window

[ Edited ]

yes i put it in my app, thank you