How to Add Custom Quick Settings Tile in Android App
There are still a lot of ways to enhance your Android app’s seamless experience.
One interesting way to do it in Android is by using Quick Settings tiles.
What is Quick Settings Tile?
Quick Settings tiles are tiles that are displayed in the Quick Settings panel shown below.
Each Quick Setting tile represents an action that you expect users to access often and/or need fast access to. This is just perfect for our quest to enhance user’s seamless experience!!
You can read several Quick Settings tiles’ best practices to follow on the Android documentation. In this article, we’re only going to show you how you can start adding Quick Settings tile to your app.
How to Add Quick Settings Tile?
Let’s use Bobobox app as our example once more.
If you’re staying in Bobobox, when you’ve checked in to your hotel/cabin, you would be able to control your room with your app like shown below:
As you can see, you can turn on and turn off your room’s door lock, windows blur, and lights. Let’s replicate these functionalities with Quick Settings tile!
1. Create a new class that extends
TileService. As shown in the code snippet below, we’re creating a class that will control a cabin’s door lock state. The most important thing to notice here is the usage of
onClick method to determine the behavior when user clicks on the tile.
2. The next thing you need to do is to register your
TileService class to your app’s
AndroidManifest.xml file like shown below:
3. That’s it! Now you can run your app and see the Quick Settings tile in action:
That’s the basic of adding Quick Settings tile! You can tweak and improve upon this concept according to your own app’s needs.