My app has a Tile Service.
After clicked on that tile, the onClick
function run perfectly fine, but I wanted to close the quick setting panel, is there anyway to achive that goal?
My app has a Tile Service.
After clicked on that tile, the onClick
function run perfectly fine, but I wanted to close the quick setting panel, is there anyway to achive that goal?
Improvement to the right answer to resolve compatibility issue with old versions on Android:
Intent(this, DestinationActivity::class.java).also {
it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
TileServiceCompat.startActivityAndCollapse(
this@MyTileService,
PendingIntentActivityWrapper(
this@MyTileService,
0,
it,
PendingIntent.FLAG_UPDATE_CURRENT,
true
)
)
}
You can use
startActivityAndCollapse
instead ofstartActivity
in your onClick function in TileService which will collapse the QS panel.