Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick Settings Tile in ACTIVE state on boot when ACTIVE_TILE enabled

Tags:

android

When you use META_DATA_ACTIVE_TILE, onStartListening() TileService callback, which updates Tile state will fire when you call TileService.requestListeningState().

It works, but when the device boots, Tile is in ACTIVE state until you click it. If ACTIVE_TILE not set the tile stays in INACTIVE state on boot.

How to solve it?

Android 7.1.2

like image 833
br. Avatar asked May 25 '18 09:05

br.


1 Answers

I think the documentation is not that clear in this case. I was having the same problem, and after several tries I found a solution for my case.

The manifest stays:

<meta-data android:name="android.service.quicksettings.ACTIVE_TILE"
            android:value="true" />

And then in the quickTileService override onBind and call RequestListeningState:

override fun onBind(intent: Intent?): IBinder {
    TileService.requestListeningState(this,
            ComponentName(this, QSTileService::class.java))
    return super.onBind(intent)
}

And on the onStartListening you can update your tile:

override fun onStartListening() {
    super.onStartListening()
    updateTile()
}
like image 81
juancamilo87 Avatar answered Oct 18 '22 05:10

juancamilo87