Skip to content

Instantly share code, notes, and snippets.

@ElifBon

ElifBon/TriggerActivity.kt

Last active Jul 16, 2019
Embed
What would you like to do?
fun createSlice(sliceUri: Uri): Slice {
val activityAction = createActivityAction()
return list(context, sliceUri, INFINITY) {
row {
title = "Perform action in app"
primaryAction = activityAction
}
}
}
private fun createActivityAction(): SliceAction? {
return SliceAction.create(
PendingIntent.getActivity(
context, 0, Intent(context, MainActivity::class.java), 0
),
IconCompat.createWithResource(context, R.drawable.ic_launcher_foreground),
ListBuilder.ICON_IMAGE,
"Open App"
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.