hardware back button is not working

Hi all

I don’t know why hardware back button is not working(on device of wp8). I try many ways but nothing done.

explain to me why(example…:D)

thanks 

Hi @tech74,

The “back” button should work (but only that button currently, not other hardware buttons on WP8). We’ll likely need to see your code to help diagnose…

Thanks,

Brent

The back key event definitely works on WP8.  We have a code example of how to use it here…

   http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#back-key-support

You should also double check your key event listener doesn’t trigger any Lua runtime errors as well that is preventing your back key functionality from working.  You can see errors and other log messages (such as from your print statement) in Visual Studio’s “Output” panel while running your app in Visual Studio’s debugger.

plz help me!!!

function BaseScene:enterScene(event)

    self.onKeyEvent = function(event)

        local phase = event.phase

        local keyName = event.keyName

        if keyName == “back” then

            if phase == “up” then

                self:onBackEvent()

            end

            return true

        elseif keyName == “menu” then

            if phase == “up” then

                self:onMenuEvent()

            end

            return true

        end

        return false

    end

    Runtime:addEventListener(“key”, self.onKeyEvent)

Hi @tech74,

I suggest that you mimic the example that we provide, since it’s been proven to work. Your function setup and usage of “self.*” and other things may be the reason it’s failing.

Best regards,

Brent

Try changing this:

if phase == “up” then

to

if phase == “down” then

There doesn’t seem an “up” phase at least not in the Windows 8 Phone simulator.

Rob

Hi @tech74,

The “back” button should work (but only that button currently, not other hardware buttons on WP8). We’ll likely need to see your code to help diagnose…

Thanks,

Brent

The back key event definitely works on WP8.  We have a code example of how to use it here…

   http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#back-key-support

You should also double check your key event listener doesn’t trigger any Lua runtime errors as well that is preventing your back key functionality from working.  You can see errors and other log messages (such as from your print statement) in Visual Studio’s “Output” panel while running your app in Visual Studio’s debugger.

plz help me!!!

function BaseScene:enterScene(event)

    self.onKeyEvent = function(event)

        local phase = event.phase

        local keyName = event.keyName

        if keyName == “back” then

            if phase == “up” then

                self:onBackEvent()

            end

            return true

        elseif keyName == “menu” then

            if phase == “up” then

                self:onMenuEvent()

            end

            return true

        end

        return false

    end

    Runtime:addEventListener(“key”, self.onKeyEvent)

Hi @tech74,

I suggest that you mimic the example that we provide, since it’s been proven to work. Your function setup and usage of “self.*” and other things may be the reason it’s failing.

Best regards,

Brent

Try changing this:

if phase == “up” then

to

if phase == “down” then

There doesn’t seem an “up” phase at least not in the Windows 8 Phone simulator.

Rob