質問

I am little confused about System.Global. According to this document (third point under Important Behavioral Changes) it says that few of the features like turning airplane mode on/off have been include in System.Global in Android 4.2 and higher so its now read only we cannot write it.

Along with airplane mode there is also Bluetooth turn on/off feature included in System.Global which means we shouldn't be able to toggle Bluetooth on/off programmatically since its read only.

But I have some app in my Nexus 7 which runs on version 4.4.2 where the app can easily turn on/off Bluetooth on voice command (one such app is 'Assistant')

How is it possible if the features in System.Global are read only?

Any explanation on this topic will be very much appreciated. Thanks in advance :)

役に立ちましたか?

解決

System settings are generally read-only for normal apps. The "Assistant" or "Settings" applications are bundled with the platform and have special permissions. Bluetooth does expose the ability to turn a given "adapter" off and on via the BluetoothAdapter class.

他のヒント

Starting with Android 5.0, it's possible to access some of the settings.

You can use the method setGlobalSetting() in the DevicePolicyManager for that.

However, the caller app must be device owner which is not available to apps deployed on Google Play.

To deploy and activate a device owner, you must perform an NFC data transfer from a programming app to the device while the device is in its unprovisioned state. This data transfer sends the same information as in the provisioning intent described in Managed provisioning.

Source: Android 5.0 APIs

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top