shibbs / Radian

Radian Phonegap App
0 stars 0 forks source link

Detecting whether or not headset is connected with smart error message #122

Open rowanc opened 11 years ago

rowanc commented 11 years ago

Looks possible but also need to check if the sound is being routed over bluetooth (but probably an edge case). http://developer.android.com/reference/android/media/AudioManager.html#isWiredHeadsetOn%28%29

rowanc commented 11 years ago

For android we can detect whether or not headsets are plugged in or not: http://stackoverflow.com/questions/16395054/check-whether-headphones-are-plugged-in I am little worried it may not be consistent across devices so am hesitant to do it.

But for ios: I can check for headsets plugged in: http://stackoverflow.com/questions/16187757/detect-if-headset-is-plugged-in-ios-5 And for the constants to check: https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSessionPortDescription_class/Reference/Reference.html#//apple_ref/doc/constant_group/Output_Port_Types

I can even subscribe to the event so that we can display whether or not the radian is plugged in using notification center on AVAudioSessionRouteChangeNotification