首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使蓝牙可被发现

使蓝牙可被发现
EN

Stack Overflow用户
提问于 2012-02-14 13:03:31
回答 1查看 1.5K关注 0票数 0

我想让蓝牙可被发现,有没有办法,android允许我的应用程序这样做吗?

我已经找到了这个链接,但是我不知道我该怎么做。

代码语言:javascript
复制
[http://developer.android.com/reference/android/provider/Settings.System.html#BLUETOOTH_DISCOVERABILITY][1]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-02-14 13:08:23

通过此代码,您的设备将在300秒内可被发现

代码语言:javascript
复制
 if (mBluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
        Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
        startActivity(discoverableIntent);
    }
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9271969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档