BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 04-03-2011, 10:45 PM   #1 (permalink)
New Member
 
Join Date: Apr 2011
Model: 8720
PIN: N/A
Carrier: claro
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default FolderListening dont work

Please Login to Remove!

messageAdded() method is not executed when the new mail coming to my mobile.

my code:

public class EmailListener implements FolderListener {
public static final long RTSID_MY_APP = 0x7451402f595f81a5L;
private AuroraApp app;

private EmailListener() {
try {
Store store = Session.getDefaultInstance().getStore();
store.addFolderListener(this);
} catch (Exception e) {
System.out.println(e.toString());
}
}

public static EmailListener waitForSingleton() {
RuntimeStore store = RuntimeStore.getRuntimeStore();
Object obj = store.get(RTSID_MY_APP);

if (obj == null) {
store.put(RTSID_MY_APP, new EmailListener());
return (EmailListener)store.get(RTSID_MY_APP);
} else {
return (EmailListener)obj;
}
}

public void messagesAdded(FolderEvent e) {

final Message originalMessage = e.getMessage();
Folder messageFolder = originalMessage.getFolder();

if (messageFolder.getType() == Folder.INBOX) {
UiApplication.getUiApplication().invokeAndWait(new Runnable() {
public void run() {
app.newMailArrived();
}
});
}
}

public void setApplication(AuroraApp app) {
this.app = app;
}

public void messagesRemoved(FolderEvent e) {
// Nothing yet
}


and the other class:

public class AuroraApp extends UiApplication {

private Client client;


public Client getClient() {
return client;
}

public void setClient(Client client) {
this.client = client;
}


private AuroraApp() {

try
{
LoginScreen ms = new LoginScreen();
EmailListener.waitForSingleton().setApplication(th is);
pushScreen(ms);

}
catch (Exception e) {
System.out.println("-----------------> exception!!");e.printStackTrace();
}
}

public static void main(String[] args) {
AuroraApp app = new AuroraApp();
app.enterEventDispatcher();

}


public void newMailArrived() {
System.out.println("new mails incoming");
}


}

please, help me
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: FolderListening dont work
Thread Thread Starter Forum Replies Last Post
HOWTO: Use BlackBerry on Generic NON-BlackBerry Data Plan Mark Rejhon BlackBerry Network 92 03-08-2014 12:26 PM
Work Email Restriction Issues? ricpac General BlackBerry Discussion 2 12-13-2007 10:23 AM
webmail on BIS fine, work email not ahw01 General BlackBerry Discussion 1 11-05-2007 12:57 PM
Blackberry Work in Korea? wangta01 General BlackBerry Discussion 10 09-27-2006 08:55 AM
Help Home address and Work address fabius Developer Forum 2 09-26-2006 05:52 AM

NEW 500x Nemco LTCC Series 0.33uF Tantalum Capacitor LTCC1065-3340-01
$24.99
NEW 500x Nemco LTCC Series 0.33uF Tantalum Capacitor LTCC1065-3340-01 picture10pcs 16V 33uF 16V Nichicon FG 5x11mm High quality Capacitor
$2.99
10pcs 16V 33uF 16V Nichicon FG 5x11mm High  quality Capacitor pictureFarad Capacitor 2.7V 500F 6 Pcs/1 Set Super Capacitance With Protection Board
$38.99
Farad Capacitor 2.7V 500F 6 Pcs/1 Set Super Capacitance With Protection Board picture10pcs Nippon Chemi-Con 1000uF 10V Radial Electrolytic Capacitors 105C NCC 8X20mm
$1.89
10pcs Nippon Chemi-Con 1000uF 10V Radial Electrolytic Capacitors 105C NCC 8X20mm picture15 x Arcotronics MKT-R60-MN-3330-BM00K 330nF 400V polyester capacitor 0.33uf
$11.91
15 x Arcotronics MKT-R60-MN-3330-BM00K 330nF 400V polyester capacitor 0.33uf picture






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