GitHub user 13leaf opened a pull request:
https://github.com/apache/incubator-cordova-android/pull/20
Fixed the issue for override backbutton(other system button) can not
intercept native rightly in some platform.
...ton(like back) as wish.
before onKeyUp,onKeyDown may handle back button.See
http://developer.android.com/reference/android/app/Activity.html#onKeyDown(int,
android.view.KeyEvent).
Although it says onKeyDown only perform onBackPressed() immediately when
the targetSdk version is lower than 5.
I make DroidGap override onBackPressed(),and breakpoint for that.
I see onKeyDown will always handle onBackPressed(),even my emulator's sdk
version is 2.2.
After that,I test it in Sumsung P1000(2.2),the result is same.
So I change cordova's onKeyUp to onKeyDown.I think that can help for
intercept system key quickly and right.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/13leaf/incubator-cordova-android master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-cordova-android/pull/20.patch
----
commit c1efe757fb85c3a251b98a62cfe0a37c29f862c2
Author: 13leaf <[email protected]>
Date: 2012-05-14T18:52:41-07:00
use onKeyUp to intercept system key event don't help override system
button(like back) as wish.
before onKeyUp,onKeyDown may handle back button.See
http://developer.android.com/reference/android/app/Activity.html#onKeyDown(int,
android.view.KeyEvent).
Although it says onKeyDown only perform onBackPressed() immediately when
the targetSdk version is lower than 5.
I make DroidGap override onBackPressed(),and breakpoint for that.
I see onKeyDown will always handle onBackPressed(),even my emulator's sdk
version is 2.2.
After that,I test it in Sumsung P1000(2.2),the result is same.
So I change cordova's onKeyUp to onKeyDown.I think that can help for
intercept system key quickly and right.
----