Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add my app shortcut to notification panel

Tags:

android

How can I add a button of my app or shortcut to the notification panel?

I researched it but unfortunately no results.

I want something like this picture below, as you can see some apps created their shortcuts in there (like Adm and windscribe)

enter image description here

like image 250
arman Avatar asked Oct 16 '25 10:10

arman


1 Answers

You must create your own Tile and a TileService to handle the following action:

class CustomTileService: TileService(){

    override fun onClick() {
        super.onClick()
    }

    override fun onTileRemoved() {
        super.onTileRemoved()
    }

    override fun onTileAdded() {
        super.onTileAdded()
    }

    override fun onStartListening() {
        super.onStartListening()
    }

    override fun onStopListening() {
        super.onStopListening()
    }
}

And declare the correct permissions at the manifest:

<service
    android:name=".CustomTileService"
    android:icon="@drawable/tile_icon"
    android:label="@string/tile_name"
    android:enabled="true" 
    android:exported="true"
    android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">

    <intent-filter>
        <action android:name="android.service.quicksettings.action.QS_TILE"/>
    </intent-filter>
</service>

You can find further information at Android docs: https://developer.android.com/reference/android/service/quicksettings/Tile

like image 71
Juan Diego Lozano Avatar answered Oct 18 '25 06:10

Juan Diego Lozano