Android应用程序蓝牙可见持续时间 [英] Android Application Bluetooth visibility duration

查看:541
本文介绍了Android应用程序蓝牙可见持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让我的应用程序可被发现的应用程序正在运行时间?我试图用

Is there a way to let my application be discoverable for a time the app is running? I tried to do this with

Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);
startActivityForResult(discoverableIntent, DISC_DURATION);

如在Android开发者,但0的持续时间不工作,所以默认值120设置。有没有办法将其设置为可见的所有时间?

as shown on Android Developers, but the Duration of 0 doesn't work so the default value 120 is set. Is there a way to set it as visible all the time?

推荐答案

我来三个设备我的结论。

I come to the conclusion on three devices I have.

ANDROID v 4.3和更高版本:EXTRA_DISCOVERABLE_DURATION 0作品没有限制 ANDROIND V4.1版本:EXTRA_DISCOVERABLE_DURATION 0是最大1小时。必须手动更改为参数没有限制。

ANDROID v 4.3 and higher : EXTRA_DISCOVERABLE_DURATION 0 works no limit ANDROIND v 4.1 : EXTRA_DISCOVERABLE_DURATION 0 is max 1 hour. Have to change manually to no limit in parameters.

这篇关于Android应用程序蓝牙可见持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆