1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
'''
Module of Android API for plyer.bluetooth.
'''
from jnius import autoclass
from plyer.platforms.android import activity
from plyer.facades import Bluetooth
Global = autoclass('android.provider.Settings$Global')
class AndroidBluetooth(Bluetooth):
'''
Implementation of Android Bluetooth API.
'''
def _get_info(self):
bluetooth_enabled = Global.getString(
activity.getContentResolver(),
Global.BLUETOOTH_ON
)
status = 'off'
if bluetooth_enabled:
status = 'on'
return status
def instance():
'''
Instance for facade proxy.
'''
return AndroidBluetooth()
|