Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 32
Registered: ‎05-24-2009
My Device: Not Specified

Audio.setVolume(0) is it RIM API Bug ???

I try to set  Phone volume to 0 using RIM api 




Alert.mute(true); Audio.setVolume(0); Alert.setVolume(0);



But after make an incomming call  The master volum set to 100 automatically (i displayed  the master volume and alert volume in my app then the alert shows 0 and master volume set to 100. Before the incomming call the both volume levels are zero ).


Then what is men by this function?


In API it is clarly specified that 



setVolume public static boolean setVolume(int volume) Sets the desired master audio volume. Parameters: volume - Percentage of maximum volume. Returns: False if an error occurred. Since: JDE 4.0.2 Category: Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.




Then how can i set the master volume to ZERO or switch Silent profile .








Plese see my previous thread also(http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=54915)





New Developer
Posts: 22
Registered: ‎08-13-2008
My Device: Not Specified

Re: Audio.setVolume(0) is it RIM API Bug ???

As I understand it, the mute() and setVolume() calls work as specified, but as soon as RIM's Phone application starts up it ignores your settings and uses its own, based on the current profile. So the API works as specified, it's just useless for alerts related to incoming phone calls and messages. Apparently you should only use the API to mute your own custom alerts.


There's no API to control the Phone application, though OS 5.0 will let you write on part of the screen. 

Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Audio.setVolume(0) is it RIM API Bug ???

if you are trying to cancel the audio on an incoming call, you will have to call stopAudio and/or play a blank audio sound to cancel the ringtone (you will have to do this constantly for however long the ringtone will be played since if it loops it will play audio again).
Posts: 32
Registered: ‎05-24-2009
My Device: Not Specified

Re: Audio.setVolume(0) is it RIM API Bug ???

[ Edited ]


There is one solution for that  ,

We can mute the phone by switch the profile.

Unfotunately there  is no api for the same


But it is possible with the help of event injection.



Have you any idea about the key kode for switch between silent profile and loud profile (any other profile ie may be # - key code)   



Message Edited by prajith on 08-18-2009 12:36 AM