Welcome!

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

Reply
Highlighted
Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

How to make the phone beep? Alert works in simulator but not on real phone.

I'm using Alert.startBuzzer() to make a beep.  It works in the simulator but nothing happens on the phone, not even out of the earpiece.

The phone's master volume is all the way up, I tried using Alert.startBuzzer(... , Audio.getVolume()) and also Alert.startBuzzer(... , 50), both work on the sim but not the real phone.

 

Couldn't figure out how to use AudioPathControl with Alert.startBuzzer.

 

Thought this would be simple, surely it must be, what am I missing?  Thanks,

 

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: How to make the phone beep? Alert works in simulator but not on real phone.

Forget about Alert - this is for old-old-old phones with monotonic sound devices.

 

Use Player and Manager.

 

 

 

 

Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Re: How to make the phone beep? Alert works in simulator but not on real phone.

Do I have to use a player to make a simple beep?  This does work in the simulator.

 

But if that's the only way, then before I waste more time figuring it out, does anyone who's done it feel like sharing the code to make a beep out of the phone speaker... that actually works on a real phone in use these days?  Thanks,

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to make the phone beep? Alert works in simulator but not on real phone.

Try using this instead of startBuzzer.

 

What JDE are you using for development and what device are you using?

 


    public static final boolean playTune(short [] tune, int volume) {
        if ( Alert.isAudioSupported() ) {
            Alert.startAudio(tune, volume);
            return true;
        }
        if ( Alert.isBuzzerSupported() ) {
            Alert.startBuzzer(tune, volume );
            return true;
        }
        return false;
    }

Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Re: How to make the phone beep? Alert works in simulator but not on real phone.

4.2.1 API on 8330.  When the Alert.startBuzzer() is called the firewall gives the "trying to access multimedia..." prompt, but after that was Allowed, no sounds.  So the API must be there, the firewall catches it.  Looked for a setting in the profile that might be canceling the alert, couldn't find anything likely, but I'm no BB expert even as a user.

 

Ended up using Manager.playTone which is more annoying because you can't specify the frequency and have to convert to a MIDI note, and on the Storm it plays a piano note instead of a beep, but at least that's something.

 


 

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to make the phone beep? Alert works in simulator but not on real phone.

and after you allowed the access and do it again?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 31
Registered: ‎03-03-2010
My Device: 9700
My Carrier: ATT

Re: How to make the phone beep? Alert works in simulator but not on real phone.

Would you mind sharing the Alert.StartBuzzer() code?

 

Thanks in advance.