1

I have an phonegap application, and I need to trigger an event when a button is pressed on the device (not a button on the screen).

Is there a way to detect, say, volume change (in iPhone and maybe other devices too) ?

I use Phonegap, mgwt and gwt-phonegap.

Majid Laissi
  • 19,188
  • 19
  • 68
  • 105

2 Answers2

1

Check out this answer for Android. There appears to be a PhoneGap plugin for iOS which lets you control the volume. This could be modified to fire an event on volume change.

Community
  • 1
  • 1
1

You can get a simple event when such a button is pressed from gwt-phonegap.

Your code would look like this:

 phoneGap.getEvent().getVolumneUpButtonPressedHandler().addVolumneUpButtonPressedHandler(new VolumeUpButtonPressedHandler() {

  @Override
  public void onVolumeUpButtonPressed(VolumeUpButtonPressedEvent event) {
    // volume up button pressed

  }
});
Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43