bluetooth action request enable resultCode

1,043 views
Skip to first unread message

Sergey Kruk

unread,
Jun 10, 2010, 11:51:03 AM6/10/10
to android-platform
Hello!

When trying to use code example from bluetooth tutorial (http://
developer.android.com/guide/topics/wireless/bluetooth.html) I get get
following behavior.

Staring Bluetooth chat sample with Bluetooth turned off:

Intent enableIntent = new
Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableIntent, REQUEST_ENABLE_BT);

in onActivityResult I get opposite resultCode for what I've done:

public void onActivityResult(int requestCode, int resultCode,
Intent data) {
if(D) Log.d(TAG, "onActivityResult " + resultCode);
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
if (D) Log.d ("Bluetooth request connect resultCode: " +
resultCode);
break;
.............
}
}


If I agree to enable Bluetooth, the request code is 0
(Activity.RESULT_CANCELED). If I answer 'no' and don't enable the
device I get -1 (Activity.RESULT_OK)

What am I doing wrong, what do I miss? How can I report a bug?

Sergey Kruk

jaikumar Ganesh

unread,
Jun 14, 2010, 8:51:20 PM6/14/10
to android-...@googlegroups.com
Hey Segery:
   Which device are you testing this app on ?

Thanks


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Sergey Kruk

unread,
Jun 16, 2010, 12:19:44 PM6/16/10
to android-platform
Hello!

Device is HTC Desire. I filed this issue here:
http://code.google.com/p/android/issues/detail?id=9013

Sergey Kruk
========================================
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>
> > .

jaikumar Ganesh

unread,
Jun 17, 2010, 12:19:26 AM6/17/10
to android-...@googlegroups.com
Yes its a compatibility problem with HTC Desire. It works fine on Nexus One and Droid. HTC has fixed this in their software and I believe should be available in the next software update.

Thanks

To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages