Slide 1

Slide 1 text

Introduction to Instant Apps⚡ Marcin Koziński

Slide 2

Slide 2 text

Instant Apps? Native apps that run without installation

Slide 3

Slide 3 text

https://developer.android.com/topic/instant-apps/ux-best-practices.html

Slide 4

Slide 4 text

https://developer.android.com/topic/instant-apps/ux-best-practices.html sandbox/runtime .apk .apk .apk or

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

.apk

Slide 7

Slide 7 text

.apk .apk .apk .apk

Slide 8

Slide 8 text

.apk .apk .apk .apk

Slide 9

Slide 9 text

.apk .apk .apk .apk

Slide 10

Slide 10 text

.apk .apk .apk .apk

Slide 11

Slide 11 text

.apk .apk .apk .apk base

Slide 12

Slide 12 text

.apk .apk .apk .apk features base

Slide 13

Slide 13 text

.apk .zip .apk .apk .apk features base

Slide 14

Slide 14 text

.apk .zip .apk .apk .apk features base .apk .zip

Slide 15

Slide 15 text

.apk .zip .apk .apk .apk features base single feature multi-feature .apk .zip

Slide 16

Slide 16 text

single feature sandbox/runtime .apk .apk .zip

Slide 17

Slide 17 text

.apk .zip .apk .zip .apk .apk .apk features base single feature multi-feature

Slide 18

Slide 18 text

.apk .zip .apk .apk .apk features base multi-feature sandbox/runtime .apk .apk feature base

Slide 19

Slide 19 text

.apk .zip .apk .apk .apk features base multi-feature .apk feature sandbox/runtime

Slide 20

Slide 20 text

apply plugin: 'com.android.application' apply plugin: 'com.android.library'
 !// New in com.android.tools.build:gradle:3.0.0 apply plugin: 'com.android.feature' apply plugin: 'com.android.instantapp' a

Slide 21

Slide 21 text

Single-feature instant app .java :app .java .xml .png apply plugin: 'com.android.application' .java

Slide 22

Slide 22 text

Single-feature instant app .java :app .java .xml .png apply plugin: 'com.android.application' .java :base apply plugin: 'com.android.library'

Slide 23

Slide 23 text

Single-feature instant app .java :app .java .xml .png apply plugin: 'com.android.application' .java :base !//apply plugin: 'com.android.library' apply plugin: 'com.android.feature'

Slide 24

Slide 24 text

Single-feature instant app .java :app .java .xml .png apply plugin: 'com.android.application' .java :base !//apply plugin: 'com.android.library' apply plugin: 'com.android.feature' :instantapp apply plugin: 'com.android.instantapp'

Slide 25

Slide 25 text

Single-feature instant app :app apply plugin: 'com.android.application' :base baseFeature true dependencies { !//… application project(‘:app') } :instantapp apply plugin: 'com.android.instantapp'

Slide 26

Slide 26 text

Multi-feature instant app :app :base :instantapp :feature-a :feature-b

Slide 27

Slide 27 text

https://www.flickr.com/photos/centralasian/5229725173

Slide 28

Slide 28 text

do don’t

Slide 29

Slide 29 text

4MB limit • You: <4MB? NO WAI • Me: YAS WAI # • APK Analyzer, Proguard, shrink resources/unused resources, .webp, … • Android Instant Apps: Best practices for managing download size • Wojtek Kaliciński: #SmallerAPK, session at Google I/O '17

Slide 30

Slide 30 text

https://developer.android.com/topic/instant-apps/ux-best-practices.html sandbox/runtime .apk .apk .apk or

Slide 31

Slide 31 text

Derp links

Slide 32

Slide 32 text

Deep links

Slide 33

Slide 33 text

Deep links ! ! !!!

Slide 34

Slide 34 text

Deep links !// Later in activity onCreate final Uri uri = getIntent().getData(); if (uri !!= null) { uri.getPathSegments(); !// List ["hello", "world"] }

Slide 35

Slide 35 text

App Links ! !

Slide 36

Slide 36 text

App Links ! !

Slide 37

Slide 37 text

App Links • Upload a special JSON to a “well-known” location on your servers.
 https:///.well-known/assetlinks.json • https://d.android.com/training/app-links/index.html • http://zdominguez.com/2017/01/20/testing-autoverify.html • App links assistant in Android Studio • MCE 2017: Cyril Mottier, Seamless Linking to Your App

Slide 38

Slide 38 text

Default URL

Slide 39

Slide 39 text

Default URL …q ! !

Slide 40

Slide 40 text

Default URL ! …q ! !

Slide 41

Slide 41 text

Implement runtime permissions https://material.io/guidelines/patterns/permissions.html#permissions-request-patterns

Slide 42

Slide 42 text

What API levels does this support? Google I/O ’16 Keynote: “All the way back to Jelly Bean!!!1” Demoed on a KitKat device! Android 5.0 Lollipop (API 21)+

Slide 43

Slide 43 text

Restrictions • Only available device identifier: Advertising ID • You can’t see a full list of apps installed on the device • Can’t change device settings such as change the user's wallpaper • No running in the background • No push notifications • No access to external storage • You’ll receive only some implicit broadcasts

Slide 44

Slide 44 text

Restrictions • Network traffic from inside the instant app must be encrypted using a TLS protocol like HTTPS

Slide 45

Slide 45 text

Tools • Android Studio 3.0, Android Gradle Plugin 3.0. • Instant Apps SDK (downloadable from the SDK Manager in AS). •aimplementation 'com.google.android.instantapps:instantapps:1.0.0' • Mostly all existing libraries, subject to “requirements & restrictions” • Mostly normal workflow: run from AS, attach debugger, etc.
 (Note: need to sign in with a Google account on device/emulator.)

Slide 46

Slide 46 text

Photo by Helloquence on Unsplash

Slide 47

Slide 47 text

Publishing https://medium.com/aubergine-solutions/its-all-about-android-instant-apps-e27b66c04a07

Slide 48

Slide 48 text

https://developer.android.com/topic/instant-apps/index.html “Native Android apps that run instantly,
 without the installation” “An upgrade to your existing Android app, not a new, separate app. It's the same Android APIs, the same project, and the same source code.”

Slide 49

Slide 49 text

Learn more… • Docs at https://g.co/instantapps • Podcasts: • Fragmented #090 with Zarah Dominguez, • ADB 84: Instant Apps • 3 Google I/O '17 sessions (linked here, here and here) • Android Instant Apps, step-by-step: how Vimeo went about it • From Westinghouse to Android Instant apps, a BuzzFeed Journey • Ask me @marcinkozinski