Phonegap how is it possible to have a “settings” page from the application menu?

StackOverflow https://stackoverflow.com/questions/12239860

  •  29-06-2021
  •  | 
  •  

質問

I am developing an application for phonegap and discovered that when I press the menu button on my phone, I see an option named "settings".

The option that gets triggered on the debugger when I choose it is the following:

: D/DroidGap(12793): onMessage(onOptionsItemSelected,Settings)

Is there any possible way to hook that call to a page/parametered query inside the application, something in the lines of "settings.html" or "index.html?page=settings"?

I tried to google around but with no luck. My application just got upgraded to version 2.0, but I do not believe that this matters.

Update: This is an extract of my current implementation:

var onMenuKeyDown;
onMenuKeyDown = function(ev) {
  return $("#mainBox").html(ev.type);
};
document.addEventListener("menubutton", onMenuKeyDown, false);

It seems to change "mainBox"'es inner html to "menubutton" when firing the event on the simulator, but this does not happen when I run it on the actual devise.

役に立ちましたか?

解決

You have two options.

1) You can listen for "menubutton" events then provide your own html settings page. 2) You can implement a native preferences pane and call it via the AppPreferences plugin.

http://simonmacdonald.blogspot.com/2012/06/phongap-android-application-preferences.html

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top