Peacemoon
Peacemoon

Reputation: 3318

Blackberry WebWorks and the "Hardware Back Button"

i have problem with the "hardware back button" and Blackberry Webworks.

I'm using jquery mobile to create a phonegap application for Blackberry WebWorks (Smartphone version). When i have a link in my page like:

<a href="#" onclick="history.back()"></a>

everything works fine.

But when i use the WebWorks API to hook the "Hardware Back Button" like this

blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,
function() {
   history.back();
   return false;
});

My app is just closed. (I tested on 9800 OS6 Simulator, and real device 9300 Curve 3G with OS6)

It's also strange when I modify the function to:

blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,
function() {
   alert('Debug');
   return false;
});

then my app will not be closed (which should be correct)

So the problem is the calling "history.back()" inisde the onHardwareKey handler function.

Can anyone help me further?

Thanks

Upvotes: 4

Views: 2471

Answers (1)

Calvin
Calvin

Reputation: 462

Adding this to config.xml worked for me:

<feature id="blackberry.system.event" version="1.0.0"/>

Upvotes: 4

Related Questions