Samsung volume control required

I didn’t implement any volume control in my Corona application. Samsung rejected my application with the following reason:

Unable to control volume by SIDE key(*No volume control option) <Defect>
It is not possible to control the volume by the SIDE key (*There is no volume control option in the application).

※Pre-condition: Application generates sound
<Procedure>

  1. Execute the application
  2. Select the SIDE Key when the sound is playing

<Expected Result>
The SIDE key should control the volume
*All android devices have volume control key and users are used to control volume by the SIDE key.

Help much appreciated.

Do you have a “key” event listener set up?  If so, then you may be overriding the volume keys by mistake.  Make sure to only return true from your “key” event listener for only the keys that your app handles.  Returning false tells the operating system to handle the key instead.  Have a look at the example code in the following API documentation…

   http://docs.coronalabs.com/api/event/key/keyName.html

http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

I plan to try out this code from the above post.

if ( keyName == "volumeUp" and phase == "down" ) then local masterVolume = audio.getVolume() print( "volume:", masterVolume ) if ( masterVolume \< 1.0 ) then masterVolume = masterVolume + 0.1 audio.setVolume( masterVolume ) end elseif ( keyName == "volumeDown" and phase == "down" ) then local masterVolume = audio.getVolume() print( "volume:", masterVolume ) if ( masterVolume \> 0.0 ) then masterVolume = masterVolume - 0.1 audio.setVolume( masterVolume ) end end return true --SEE NOTE BELOW &nbsp;

That’s not what Samsung wants you to do.  They want you to let the volume controls adjust the operating system’s volume controls.  The only way to do that is to *not* handle them.  For example, if you comment out your key event listener, notice pressing the volume control button will show the operating system’s volume popup instead.  That’s what they’re looking for.

What you’re doing is different.  Using Corona’s audio.setVolume() function only effects the audio processed by Corona’s “audio” library.  It does not adjust the volume for audio played via Corona “media” APIs.  It serves a different purpose.

Thank you! I was handling the back button to show an Exit popup. I had

return true &nbsp;

Changing it to:

return false &nbsp;

in the last line worked.

Great!  Happy to help!

Do you have a “key” event listener set up?  If so, then you may be overriding the volume keys by mistake.  Make sure to only return true from your “key” event listener for only the keys that your app handles.  Returning false tells the operating system to handle the key instead.  Have a look at the example code in the following API documentation…

   http://docs.coronalabs.com/api/event/key/keyName.html

http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

I plan to try out this code from the above post.

if ( keyName == "volumeUp" and phase == "down" ) then local masterVolume = audio.getVolume() print( "volume:", masterVolume ) if ( masterVolume \< 1.0 ) then masterVolume = masterVolume + 0.1 audio.setVolume( masterVolume ) end elseif ( keyName == "volumeDown" and phase == "down" ) then local masterVolume = audio.getVolume() print( "volume:", masterVolume ) if ( masterVolume \> 0.0 ) then masterVolume = masterVolume - 0.1 audio.setVolume( masterVolume ) end end return true --SEE NOTE BELOW &nbsp;

That’s not what Samsung wants you to do.  They want you to let the volume controls adjust the operating system’s volume controls.  The only way to do that is to *not* handle them.  For example, if you comment out your key event listener, notice pressing the volume control button will show the operating system’s volume popup instead.  That’s what they’re looking for.

What you’re doing is different.  Using Corona’s audio.setVolume() function only effects the audio processed by Corona’s “audio” library.  It does not adjust the volume for audio played via Corona “media” APIs.  It serves a different purpose.

Thank you! I was handling the back button to show an Exit popup. I had

return true &nbsp;

Changing it to:

return false &nbsp;

in the last line worked.

Great!  Happy to help!

My app got rejected too, right now they want a continues volume update while holding down the volume’s up/down key.

My app got rejected too, right now they want a continues volume update while holding down the volume’s up/down key.