BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-24-2009, 03:00 AM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 8130
PIN: N/A
Carrier: Mobilink
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up FolderListener is not working in Blackberry 8300

Please Login to Remove!

I am using FolderListener for listening new incoming message but it is not working on Blackberry 8300 although I used signed cod file.I followed the article from Knowledgebase that is:

What Is - Application is not notified when new messages arrive

I am also copy-paste the code that I tried but it is not working:

First Sample:
==========
public class TestEmailListenerEmail implements FolderListener {
public TestEmailListenerEmail()
{
Store store = Session.getDefaultInstance().getStore();
//add the listener
emailListener=new EmailListener(objLI);
store.addFolderListener(emailListener);
}

// rest of code e.g main function etc
}

public class EmailListener implements FolderListener {
public EmailListener()
{
}
public void messagesAdded(FolderEvent e) {
//get the message and folder it was added to
Message orginalMessage = e.getMessage();
Logger.log("Message Arrived with Subject:"+orginalMessage.getSubject())
}

public void messagesRemoved(FolderEvent e) {


}
}


Second Sample:
============
public class TestEmailListenerEmail implements FolderListener {
EmailListener emailListener=new EmailListener();
public TestEmailListenerEmail()
{
Store store = Session.waitForDefaultSession().getStore();
Folder[] folders = store.list();
for( int foldercnt = folders.length - 1; foldercnt >= 0; --foldercnt) {
Folder f = folders[foldercnt];
recurse(f);
}
}
public void recurse(Folder f)
{
if ( f.getType() == Folder.INBOX )
{
f.addFolderListener(emailListener);
}
Folder[] farray = f.list();
for (int fcnt = farray.length - 1; fcnt >= 0; --fcnt)
{
recurse(farray[fcnt]);
}
}
// rest of code e.g main function etc

}

public class EmailListener implements FolderListener {
public EmailListener()
{
}
public void messagesAdded(FolderEvent e) {
//get the message and folder it was added to
Message orginalMessage = e.getMessage();
Logger.log("Message Arrived with Subject:"+orginalMessage.getSubject())
}

public void messagesRemoved(FolderEvent e) {
}
}


Please tell me that what is the thing that I am missing.Please response me as soon as possible.
Offline  
Old 08-07-2009, 12:34 AM   #2 (permalink)
New Member
 
Join Date: Jul 2009
Model: 8130
PIN: N/A
Carrier: Mobilink
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

My Problem is solved
Offline  
Old 08-10-2009, 12:56 AM   #3 (permalink)
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation

Quote:
Originally Posted by Aneela View Post
My Problem is solved
and what was the problem ? The solution will help others with similar problems...
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.