I want to detect the Android hardware menu button pressing in Monaca.

Asked 2 years ago, Updated 2 years ago, 90 views

Android has hardware back and menu buttons.
It's a menu button similar to the Chinese character "san" on the right side of the home button.
Is it possible to control the behavior when this menu button is clicked?
The Back button was listed on the website below.

http://ja.onsen.io/guide/overview.html#HandlingBackButton

Is it possible to do something similar with the menu button?

Please let me know if anyone knows anything.
Thank you for your cooperation.

monaca cordova

2022-09-29 22:17

1 Answers

Cordova (checked in 6.1.1) has an event called menuutton and captures it.

navigator.app.overrideButton is required, but the document does not mention navigator.app.It's a bug.

Note:
In the old Cordova, there was
bug that prevented menubutton events from occurring in the first place.
If you want to continue using the old Cordova, you have to give up or fix CordovaWebViewImpl.java and CoreAndroid.java yourself.
Affected commit: https://github.com/apache/cordova-android/commit/b6a329d479e15cdf8a7a30a8fea9c5799c73841a


2022-09-29 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.