Google Glass GDK: Bluetooth discoverable Intent

2019-07-04 23:16发布

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条回答
神经病院院长
2楼-- · 2019-07-04 23:38

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?

查看更多
登录 后发表回答