Android KitKat Bluetooth connect -


am 1 having problems connecting bluetooth startbluetoothsco? works fine in versions of android except 4.4.2 (kitkat). suggestions? , yes, have verified connected bluetooth before call this. did changed in 4.4.2?

here code:

am = (audiomanager)getsystemservice(context.audio_service); am.setmode(audiomanager.mode_in_call); am.setbluetoothscoon(true); am.startbluetoothsco(); 

following suggestion did following, driving me nuts! doing wrong. have listener in mainactivity follows...

private final bluetoothhandler.listener mbluetoothlistener = new bluetoothhandler.listener() {     @override     public void onconnectioncomplete() {         final bluetoothhandler bluetoothhandler = mbluetoothhandler;          if (bluetoothhandler != null) {             am.setmode(audiomanager.mode_in_communication);         }     }  }; 

then in oncreate initialize bluetoothhandler

if(mbluetoothhandler == null){         mbluetoothhandler = new bluetoothhandler(5000, mbluetoothlistener);     } else {         mbluetoothhandler.stopsco();         mbluetoothhandler.stop();         mbluetoothhandler = null;     }  if (!mbluetoothhandler.isaudioconnected()) {                 mbluetoothhandler.start(mcontext);             } 

the problem i'm having listener doesn't detect when bt device connects or says 1 connected. suggestions? appreciate help...

the functionality of startbluetoothsco() changed between api 17 , api 18. in api 17, function initiates virtual call via sco. in api 18, function opens raw sco link. bluetooth units respond virtual call.

unfortunately doesn't seem google have given option of choosing whether open virtual call or raw link if require virtual call, need ensure app built api 17.

from android developer reference:

"note: , including api version jelly_bean_mr1, method initiates virtual voice call bluetooth headset. after api version jelly_bean_mr2 raw sco audio connection established."

http://developer.android.com/reference/android/media/audiomanager.html#startbluetoothsco()


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -