如何弹出从​​谷歌启用蓝牙提示播放服务? [英] How to pop up Enable Bluetooth prompt from Google Play Services?

查看:520
本文介绍了如何弹出从​​谷歌启用蓝牙提示播放服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序同时使用位置和BLE,如果位置或蓝牙将被禁用我要问用户,使他们。

Application I'm working on uses both Locations and BLE and if location or bluetooth are disabled I have to ask user to enable them.

最新谷歌播放服务提供了一个标准的方式来做到这一点使用 LocationSettingsRequest 它检查的要求,如果需要设置的更改提高标准弹出。它的工作原理就像一个魅力单独的位置,但一旦我添加 SetNeedBle(真) LocationSettingsRequest 我得到一个状态 SETTINGS_CHANGE_UNAVAILABLE

Latest Google Play Services provides a standard way to do that using LocationSettingsRequest which checks requirements and raises standard popup if changes to settings are required. It works like a charm for location alone but once I add SetNeedBle (true) to LocationSettingsRequest I get a status SETTINGS_CHANGE_UNAVAILABLE.

只有我的猜测是我需要添加 AddApi(FitnessClass.BLE_API)打电话到 GoogleApiClientBuilder ,因为它可能是BLE的功能是至关重要的,但后来我得到了连接到谷歌播放服务与 SIGN_IN_REQUIRED 失败状态这是令人困惑,因为我只需要健身服务BLE一部分。

The only my guess was I need to add AddApi (FitnessClass.BLE_API) call to a GoogleApiClientBuilder as it might be vital for BLE functionality, but then I got connection to Google Play Services failed with SIGN_IN_REQUIRED status which is confusing as I just need BLE part of Fitness service.

有谁知道 LocationSettingsRequest 用法的好例子来提示用户输入两个地点和蓝牙?

Does anyone know good example of LocationSettingsRequest usage to prompt user for both locations and bluetooth?

推荐答案

看起来像它已被固定在8.1.0所以 SetNeedBle(真)按预期工作:

Look like it has been fixed in 8.1.0 so SetNeedBle (true) works as expected:

在这里输入的形象描述

这篇关于如何弹出从​​谷歌启用蓝牙提示播放服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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