问题
I try to make my Google Glass discoverable via Bluetooth in my app by calling the flowing intent:
Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 120);
startActivity(discoverableIntent);
But I get the following error message:
Unable to start activity ComponentInfo{com.example.glass/com.example.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.bluetooth.adapter.action.REQUEST_DISCOVERABLE (has extras)` }
Does anyone know if this intent is supported by Google Glass right now or not?
Of course I made sure that I set the permissions in my Manifest file:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
回答1:
That error is occurring because Glass does not have an activity registered to handle displaying the UI for that action.
Can you file a feature request in our issue tracker if you need this?
In the meantime, have you explored the workaround in this post/answer to see if it would work for you?
来源:https://stackoverflow.com/questions/22820680/google-glass-gdk-bluetooth-discoverable-intent