How to open a setting activity on quick settings tile long click

104 Views Asked by At

As per what official doc says, you can override a custom quick setting tile's default long press behavior:

Long-tapping a tile prompts the App Info screen for the user. To override this behavior and instead launch an activity for setting preferences, add an <intent-filter> to one of your activities with ACTION_QS_TILE_PREFERENCES.

However this is only possible for the tile's owner app. Is it possible instead, to open a third-party activity - specially a device setting page - on quick tile being long pressed?

1

There are 1 best solutions below

1
On

you could create an intent and set its component name to whatever activity you wanna launch. ie:

val intent = Intent(Intent.ACTION_MAIN,)

intent.setComponentName(ComponentName.unflattenFromString("com.google.android.googlequicksearchbox/com.google.android.apps.search.weather.WeatherExportedActivity")

startActivity(intent)

ofcourse this requires you to know the activity name