Languages

Menu
Sites
Language
How to get the event of pressing a button Volume + and -?

Hi all,

For my project must receive the event from press buttons Volume + & - and transfer them to your application written for Tizen 2.2.0

void OnKeyPressed ( const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode )
{
       AppLog( " OnKeyPressed." );

      if( keyCode == Tizen::Ui::KEY_SIDE_UP )
      {
            AppLog( "Press KEY_VOLUME_UP." );
      }
      else if( keyCode == Tizen::Ui::KEY_SIDE_DOWN )
      {
            AppLog( "Press KEY_VOLUME_DOWN." );
      }

}

But this is not work. Also, I can not send a new volume to my device from program.

Please, help me to solve this problem. :) 

Responses

5 Replies
Alex Ashirov

Did you try KEY_VOLUME_DOWN and KEY_VOLUME_UP instead of KEY_SIDE_DOWN andKEY_SIDE_UP?
 

Sergei Melikhov

It also does not work.

hgw7

Please try by implementing the Tizen::System listeners as follows:

SettingInfo::AddSettingEventListener(*this);

 

void
testForm::OnSettingChanged (Tizen::Base::String &key)
{
    AppLog(__PRETTY_FUNCTION__);
 

    if(key == L"http://tizen.org/setting/sound.system.volume")

         AppLog("volume1");

    else if(key == L"http://tizen.org/setting/sound.ringtone.volume")
        AppLog("volume2");
}

Sergei Melikhov

AppLog(__PRETTY_FUNCTION__);  - work;

AppLog("volume1") and AppLog("volume2"); - not work.

 

 

 

hgw7

I have checked it, and "volume2" was printed in the log file. Try to see what "key" is when Volume buttons are pressed.

AppLog("%ls", key.GetPointer());