Skip to content Skip to sidebar Skip to footer

How Can I Add My App Shortcut To Notification Panel

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

Solution 1:

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


Post a Comment for "How Can I Add My App Shortcut To Notification Panel"