Error checking if Bluetooth is enabled in Android (REQUEST_ENABLE_BT cannot be resolved to a variable)

REQUEST_ENABLE_BT is a request code that you provide. It’s really just a number that you provide for onActivityResult. It will be the requestCode (first parameter) of onActivityResult when the activity returns. You could put any number you want as long as it’s consistent in the return method.

In other words, put a line like this in the top of your Activity:

private final static int REQUEST_ENABLE_BT = 1;

Leave a Comment