BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   OutboundMessageListener doesn't detect outgoing sms (http://www.blackberryforums.com/developer-forum/260565-outboundmessagelistener-doesnt-detect-outgoing-sms.html)

Lukaszz 07-17-2012 09:52 AM

OutboundMessageListener doesn't detect outgoing sms
 
Hi, the following piece of code should print out a message when an sms is sent from the device. I've tried it several times on the simulator but nothing gets printed when I send an sms. What am I doing wrong? Why doesn't the app pick up that an sms has been sent?


public class BackGroundApp extends UiApplication implements OutboundMessageListener, javax.wireless.messaging.MessageListener {

private MessageConnection messageConnection;


public static void main(String args[])
{
BackGroundApp theApp = new BackGroundApp();
theApp.enterEventDispatcher();
}

public BackGroundApp(){
try {
MessageConnection _mc = (MessageConnection)Connector.open("sms://");
_mc.setMessageListener(this);

} catch (IOException e) {}

}

public void notifyIncomingMessage(MessageConnection messageconnection){


}

public void notifyOutgoingMessage(javax.wireless.messaging.Mes sage message) {

System.out.println("SMS just sent from your device!");

}
}

hrbuckley 07-17-2012 12:10 PM

Re: OutboundMessageListener doesn't detect outgoing sms
 
1. You need to register your listener with the MessageConnection per the API documentation.

2. The simulator can't really send SMS messages so you may have to do this on a device.


All times are GMT -5. The time now is 09:30 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.