It’s here! Yesterday we saw the announcement of the Android Q beta release 🎉 With this version of Android comes a collection of exciting changes which we need to get our apps ready for. In my next set of articles I’m going to be diving into each one of these so that we are fully prepared for getting our apps ready!
Note: You can find the code for this article here.
As outlined in the beta release notes for Android Q, one of the new features we are seeing introduced is what are known as Settings Panels. These allow us to launch panels which show commonly used settings within our apps – meaning that the user can toggle settings without having to switch context, let alone find the setting that it is they want to access. This new piece of functionality gives us access to three different settings panels, which all can be launched via a simple startActivity() call.
Each of these provides a way for the user to configure settings for these things. These settings panels require very little code to launch, we can do so with a single line of code:
The panel argument that we pass in to this intent instance is a reference to a string value defined within the Panel class.
We can launch the internet connectivity panel by passing in the ACTION_INTERNET_CONNECTIVITY value when instantiating our intent:
As you can see in the screenshot below, this gives our user the ability to quickly:
- Toggle airplane mode
- Toggle Wifi connectivity
- Change their Wifi network connection
- Navigate to connectivity settings
Showing this panel could be handy in situations such as:
- Prompting the user to connect to your wifi network (although, Q provides some extra functionality for this which we will cover in another post)
- Detecting a problem with the connection, prompting the user to check their settings
Maybe your app handles some form of media playback or calls – in these cases it’s likely that you’ll be handling audio in some way. In this case, you’ll be able to make use of the volume panel by using the ACTION_VOLUME value:
The volume panel shows several different volume options:
- Media volume
- Call volume
- Ring volume
- Alarm volume
Note: It currently looks like theres a bug where the text for each volume setting is being cut-off
If your application makes use of NFC technology then there is also an NFC panel that you can make use of. This can be done by using the ACTION_NFC value:
This simply shows NFC settings to the user. For me on my device I am just seeing a switch that launches the NFC preferences screen, maybe in future this will operate different or make us of clearer copy.
To close this post, settings panels look like they are going to provide ways for our users to quickly and easily change common settings whilst remaining in the context of our applications. Whilst they may not have a place in every app, I am confident that many apps will be able to find use cases where these can make flows easier for users.
Currently, it looks like startActivityForResult() does not return any extra data (even though in the official sample this is used). It would be nice to have some form of result returned (did the user cancel the sheet, or toggle some action). Whilst our apps should be observing certain states, having this information as a result would make this kind of implementation simpler.
Regardless, setting panels are a great addition to the Android system and I’m excited to dive into the next piece of functionality!