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

Web and WebWorks Development

Reply
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

SMS Listener not working

Hi,

 

Anybody here encountered the same issue? We tried pulling the latest SMS API from github but still it didn't work.

 

Here's the code

 

//HTML Part
<div id="callbackSMS">none here</div>
<input type="button" onclick="startSMSListener()" value="Start Listener"/>
<input type="button" onclick="removeSMSListener()" value="Remove Listener SMS"/>
<input type="button" onclick="sendSMS()" value="Send SMS"/>





//Javascript part
function sendSMS() {
	blackberry.message.sms.send("BAL", "222");
}

function startSMSListener() {
	blackberry.message.sms.isListeningForMessage = true;
	blackberry.message.sms.addReceiveListener(listenerCallback);
	alert("Initiated SMS listener");
}

function removeSMSListener() {
	if(blackberry.message.sms.removeReceiveListener()) {
		blackberry.message.sms.isListeningForMessage = false;
		alert("Listener removed.");
	} else {
		alert("No listener opened.");
	}
}

/**
 * Callback for BlackBerry SMS Listener
 * @param msg
 * @param from
 * @param date
 */
function listenerCallback(msg, from, date) {
	$("#callbackSMS").html("Called.");
}

 

Apppreciate any help.

 

thanks!

 

 

Regards,

 

 

John

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: SMS Listener not working

Are you sure the SMS listener isn't working... or could it be the jQuery you are using in the callback?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: SMS Listener not working

Hi Tim,

We also tried using alert to check if it invokes the callback. It did invoke it one time but after that, nothing happens everytime there's an incoming sms.

Thanks!

Regards,

John

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: SMS Listener not working

As a note, If you are running on BB6+ and your application is running in the background.. an alert(),confirm() will not display.  It will only display if you are the foreground application.

 

Can you post up the following information:

- WebWorks SDK version number

- Device Model Number

- Device OS version number 5.0.0.x, 6.0.0.x, 7.0.0.x

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: SMS Listener not working

Thanks tim.

Testing is done during application is in the foreground.

We are tried using webworks 2.1.
- device model Bold 9700
- os number 5.0.0

I have the full details here:
https://www.blackberry.com/jira/browse/WEBAPI-204

Thank you very much!
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: SMS Listener not working

Have you tried upgrading to v2.1.1 of the WebWorks SDK for Smartphones?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: SMS Listener not working

Yes sir. We also tried 2.1.1. We also tried to use the latest SMS API from github. And it only worked once.

Thanks!
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: SMS Listener not working

Can you give me the dot revision of 5.0

 

Right down to the 5.0.0.xyz

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: SMS Listener not working

it's 5.0.0.862

 

thanks!

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: SMS Listener not working

Sent to the testing group

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter