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
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified
Accepted Solution

AudioPathControl Question

Hello,

I found the AudioPathControl API but am not sure how to use it.

With this code I wanted to check to what audio path the audio is directed:

 

int i = AudioPathControl.getAudioPath();

 

But that gives me this compilor error:

 

: non-static method getAudioPath() cannot be referenced from a static context

 

 What am I doing wrong here?

 

 

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Retired
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: AudioPathControl Question

getAudioPath() is not defined as a static method.  You'll need to acquire a reference to an AudioPathControl instance before calling getAudioPath().  The below KB article shows how to acquire an AudioPathControl reference.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...

Brian Zubert
Technical Partnership Manager
Research In Motion
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Re: AudioPathControl Question

Thank you for your help;

I think I don't need the AudioPathControl function for the following:

I want to check if a wired headset is connected to the device. Is that possible with this API? 

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Re: AudioPathControl Question

Or is there another function that allows me to check if the wired headset is connected?  
If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Highlighted
Retired
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: AudioPathControl Question

The AudioPathControl will definitely return the result you're looking for.  Otherwise, you might also consider Audio.isHeadsetConnected(). 
Brian Zubert
Technical Partnership Manager
Research In Motion
Developer
Posts: 21
Registered: ‎03-27-2009
My Device: Not Specified

Re: AudioPathControl Question

On the BlackBerry Storm running OS 4.7.0.75, I'm seeing that the technique in the given KB article for obtaining the AudioPathControl object isn't working.  getControls[] returns one object that is an instance of a VolumeControl but not an AudioPathControl.  Player.getControl("AudioPathControl") returns null.  Should this be working for me or is this not implemented for the Storm/OS 4.7?
New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: AudioPathControl Question

Same issue for me. Anyone has a solution to this?

Per