Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A slice of Android Slices - droidcon London 2018

Adnan A M
October 26, 2018

A slice of Android Slices - droidcon London 2018

Slides for my talk at droidcon London 2018.

Adnan A M

October 26, 2018
Tweet

More Decks by Adnan A M

Other Decks in Programming

Transcript

  1. What are Android Slices ? ◎ Small Interactable UI elements

    ◎ Fancy Content Providers ◎ Remote Content Views -Widgets
  2. Why should you have a Slice ? ◎ Interactable ◎

    Dynamic/Updatable ◎ Supports API 19(Kitkat) - Yaaay
  3. Building Your First Slice ◎ Add Dependencies dependencies { //

    ... implementation "androidx.slice:slice-builders-ktx:(ver)" // ... }
  4. Building Your First Slice ◎ Extend Slice Provider class class

    CoffeeSliceProvider: SliceProvider() { .. .. }
  5. Building Your First Slice ◎ onCreateSliceProvider() - Cp.onCreate(), Ahem Ahem

    override fun onCreateSliceProvider(): Boolean { coffeeContext = context return true }
  6. Building Your First Slice ◎ onBindSlice() override fun onBindSlice(sliceUri: Uri):

    Slice? { when(sliceUri.path) { "/coffee" -> return createCoffeeSlice(sliceUri) } return null }
  7. Limitations ◎ UI Templates ◎ Search Results/Ranking ◎ Permission Slice

    ◎ Actions ◎ Slice Host Ability - For 3rd party Apps
  8. References/Credits & Source ◎ Novoda ◎ Google IO 2018 ◎

    Source Code - https://github.com/adnan-SM/slices-starbucks ◎ Slide Theme - SlidesCarnival