Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid bluetooth headset getprofileproxy returning null
    primarykey
    data
    text
    <p>I am trying to connect a bluetooth headset to my android device using the android developer page as a reference. <a href="http://developer.android.com/guide/topics/connectivity/bluetooth.html" rel="nofollow noreferrer">http://developer.android.com/guide/topics/connectivity/bluetooth.html</a></p> <p>My problem is when i trying calling the getProfileProxy(context, mProfileListener, BluetoothProfile.HEADSET) method, I am unsure of what to pass for context? I located this error from the question here: <a href="https://stackoverflow.com/questions/9532233/can-not-connect-to-bluetooth-headset-in-android">can not connect to bluetooth headset in android</a></p> <p>I am extremely new to this so I will apologize in advance if this is a silly question. I have spent a lot of time trying to research this but every example and documentation I find just has a context variable passed in so I am not sure where I am going wrong. My code, which is more or less a copy from the android documentation is:</p> <p>// Establish connection to the proxy. boolean mProfileProxy = mBluetoothAdapter.getProfileProxy(context, mProfileListener, BluetoothProfile.HEADSET); Log.d(TAGP,"Get Adapter Success: "+mProfileProxy); Log.d(TAGP,"Context: "+context);</p> <pre><code>BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() { public void onServiceConnected(int profile, BluetoothProfile proxy) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = (BluetoothHeadset) proxy; Log.d(TAGP,"BLuetooth Headset: "+mBluetoothHeadset); Log.d(TAGP,"Proxy: "+proxy); } } public void onServiceDisconnected(int profile) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = null; } } }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload