Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkey

Configure Android System Settings From Delphi XE5 Firemonkey

Delphi XE5 Firemonkey Android System SettingsJim McKeeth from Embarcadero has a blog post up where he shows how to use the Android API with Delphi XE5 Firemonkey to access the system settings of the device. Your app must request permissions from the user in the manifest to access the system settings but once you have that there are a lot of useful settings you can read and write using the android.provider.Settings.System. Some examples of the system settings you can read and write with this API are VIBRATE_ON, VOLUME_ALARM, VOLUME_BLUETOOTH_SCO, VOLUME_MUSIC, VOLUME_NOTIFICATION, VOLUME_RING, VOLUME_SYSTEM, VOLUME_VOICE and a lot more. Jim set up two functions which read and write the SCREEN_OFF_TIMEOUT setting. You should be able to easily customize the two functions to read and write any setting you need. Here is the required Android permission from the manifest:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
And here is the sample function to set the screen off timeout. It demonstrates how easy to it to send an integer from Delphi XE5 Firemonkey through the JNI interface to the Android SDK.
function SetScreenOffTimeout(ATimeOut: Integer): Boolean;
Result := TJSettings_System.JavaClass.putInt(

Head over and read Jim’s full blog post about the system settings API.


Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores


DelphiCon 2020 FireMonkey Sessions Available Starting November 19


Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply