简体   繁体   English

App Inventor 2-在应用程序关闭时禁用设备蓝牙吗?

[英]App Inventor 2 - Disable the Device Bluetooth when app closes?

I can set a variavle when the app initialises to thell me if the Device Bluetooth is enabled. 如果启用了设备蓝牙,则可以在应用初始化时设置变量。

There doesn't seem to be a method to enable Bluetooth from within the app, so I'm showing a notifier "Enable Bluetooth in Device Settings", but I'd really like to be able to disable Bluetooth when the app closes (if it was originally disabled - hence the variable) to conserve battery life. 似乎没有一种从应用程序内部启用蓝牙的方法,因此我正在显示通知程序“在设备设置中启用蓝牙”,但我真的很希望能够在应用程序关闭时禁用蓝牙(如果它最初是禁用的-因此使用该变量)以节省电池寿命。

Can this be done? 能做到吗?

Thanks 谢谢

This does not appear possible using AppInventor at this time. 目前无法使用AppInventor做到这一点。

It does appear that you have the ability to directly turn on Bluetooth, however, using the Android Bluetooth intent and the AI2 Activity Starter component. 看来您确实具有直接打开蓝牙的能力,但是可以使用Android蓝牙意图和AI2 Activity Starter组件。 See ( http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html ) for reference and ( http://www.whatakuai.com/bluetooth-and-app-inventor/ ) for implementation. 有关参考,请参见( http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html )和( http://www.whatakuai.com/bluetooth-and-app-inventor/ )。

Sadly there does not appear to be a public Intent you can use to disable the bluetooth radio using the ActivityStarter component. 遗憾的是,似乎没有可以使用ActivityStarter组件禁用蓝牙无线电的公共Intent。

use the application Bluetooth Auto Off 使用应用程序蓝牙自动关闭

it dissable the bluetooth after there is no comunication for selected time 在选定的时间内没有通信后禁用蓝牙

https://play.google.com/store/apps/details?id=com.mst.btautodisable https://play.google.com/store/apps/details?id=com.mst.bt自动禁用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM