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:

classCustomTileService: TileService(){

    overridefunonClick() {
        super.onClick()
    }

    overridefunonTileRemoved() {
        super.onTileRemoved()
    }

    overridefunonTileAdded() {
        super.onTileAdded()
    }

    overridefunonStartListening() {
        super.onStartListening()
    }

    overridefunonStopListening() {
        super.onStopListening()
    }
}

And declare the correct permissions at the manifest:

<serviceandroid: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><actionandroid: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"