BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   OutboundMessageListener doesn't detect outgoing sms (http://www.blackberryforums.com/showthread.php?t=260565)

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 03:32 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.