App Inventor Extensions: Settings | Pura Vida Apps

App Inventor Extensions


Settings Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension, bug reports and feature requests, please start a new thread in the App Inventor Extensions forum. Thank you.

Sept 2nd, 2016: Version 1: brightness properties

Jan 17th, 2017: Version 2: volume properties added

March 7th, 2017: Version 3: ringtone methods added

March 26th, 2017: Version 3b: bugfix set ringtome for ALARM or NOTIFICATION

Description

Settings extension.
Curently you can get/set the brightness get/set the alarm/ring/music volume and get/set/play a ringtone, but probably more functionality will follow one day...
Required permissions: android.permission.READ_EXTERNAL_STORAGE, android.permission.WRITE_SETTINGS

Properties


Get the brightness (a value between 0 and 255).

Thank you Tsiantakis Apps for being the sponsor of the brightness properties!

Note: To set the brightness somehow does not have any effect on the screen anymore on Android 7.1.1? Still worked on Android 7. To be checked...


Set the brightness (a value between 0 and 255).
Thank you Tsiantakis Apps for being the sponsor of the brightness properties!

Note: you will have to build the app before being able to set the brightness, because the companion app does not offer the permission android.permission.WRITE_SETTINGS, else you will get the following error:


Returns whether User Interface shoud be shown while setting the volume.


Specifies whether User Interface shoud be shown while setting the volume.


Get alarm volume in percent.
Thank you Merciful for being the sponsor of this property!


Set alarm volume in percent.
Thank you Merciful for being the sponsor of this property!


Get music volume in percent.
Thank you Merciful for being the sponsor of this property!


Set music volume in percent.
Thank you Merciful for being the sponsor of this property!


Get ring volume in percent.
Thank you Merciful for being the sponsor of this property!


Set ring volume in percent.
Thank you Merciful for being the sponsor of this property!

Methods


Get current ringtone. Type can be RINGTONE, NOTIFICATION or ALARM.
Thank you James and chabooya for being the sponsors of this method.


Set sound file as ringtone, notification and/or alarm sound. Title is a custom name for the sound. Type can be RINGTONE, NOTIFICATION or ALARM. The sound file must be stored on sdcard and in mp3 format. For files from the assets, copy them first to the sdcard using the file extension. Prefix the fileName with / (i.e. relative path) to look for the file on the SD card. For instance /myFile.pm3 will look for the file /mnt/sdcard/myFile.mp3. If fileName starts with file:/// you can specify a complete path to the file.

Note: you will have to build the app before being able to set the ringtone, because the companion app does not offer the permission android.permission.WRITE_SETTINGS

Thank you James and chabooya for being the sponsors of this method.


Play ringtone. Type can be RINGTONE, NOTIFICATION or ALARM.
Thank you James and chabooya for being the sponsors of this method.


Stop currently playing ringtone.
Thank you James and chabooya for being the sponsors of this method.

Example App: Brightness/Volume Test


Example App: Ringtone Test

Test

Tested successfully on Nexus 5X running Android 7.

Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.

Terms and Conditions

Download


If you find this example helpful and you are using it in one of your projects,
be nice and donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

Download Settings extension (aix file)

Download Brightness Test (aia file)
Download Ringtone Test (aia file)
Note: you will have to build the app before being able to set the brightness or the ringtone, because the companion app does not offer the permission android.permission.WRITE_SETTINGS

Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact