Top Banner
ChromeAndroid過去・現在・未来 Droidkaigi 2016
90

ChromeとAndroidの過去・現在・未来

Jan 19, 2017

Download

Technology

Shinobu Okano
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ChromeとAndroidの過去・現在・未来

ChromeとAndroidの 過去・現在・未来

Droidkaigi 2016

Page 2: ChromeとAndroidの過去・現在・未来

This is the last session of DroidKaigi

Page 3: ChromeとAndroidの過去・現在・未来

Thank you for coming to my session.

Page 4: ChromeとAndroidの過去・現在・未来

最後まで楽しんでください!

Page 5: ChromeとAndroidの過去・現在・未来

About Me

Shinobu Okano

@operandoOS

Mercari, Inc.

Page 6: ChromeとAndroidの過去・現在・未来
Page 7: ChromeとAndroidの過去・現在・未来

shinobu.apk

http://hack-it-iron.hatenablog.com/entry/2016/02/08/142322

shinobu.apk #1 のパネルディスカッション

録音データとShow Notesを公開しました!

Page 8: ChromeとAndroidの過去・現在・未来

まったりAndroid Framework Code Reading

http://hack-it-iron.hatenablog.com/entry/2015/11/28/185529

まったりAndroid Framework

Code Reading #2 を開催しました

Page 9: ChromeとAndroidの過去・現在・未来

WebView

Page 10: ChromeとAndroidの過去・現在・未来

WebView

つ ら い

Page 11: ChromeとAndroidの過去・現在・未来

WebView

つ ら い

Page 12: ChromeとAndroidの過去・現在・未来

1.x ~ 4.3.xWebKit

4.4.XChromium

5.0 ~System WebView

(APK)

WebView History

Page 13: ChromeとAndroidの過去・現在・未来

Google I/O 2012 Android WebView

https://www.youtube.com/watch?v=HbOtn5VhGZU

Page 14: ChromeとAndroidの過去・現在・未来

Migrating to WebView in Android 4.4

http://developer.android.com/guide/webapps/migrating.html

Page 15: ChromeとAndroidの過去・現在・未来

Android System WebViewhttps://play.google.com/store/apps/details?

id=com.google.android.webview

Page 16: ChromeとAndroidの過去・現在・未来

Android WebView の進化と実装

http://outcesticide.hatenablog.com/entry/android_webview

Page 17: ChromeとAndroidの過去・現在・未来

Chrome Custom Tabs

Page 18: ChromeとAndroidの過去・現在・未来

Show the Chrome Tab like a my app browser

Page 19: ChromeとAndroidの過去・現在・未来

Intent Chrome Custom Tabs

Page 20: ChromeとAndroidの過去・現在・未来

Chrome Custom Tabs

Page 21: ChromeとAndroidの過去・現在・未来

IntentApp Process Chrome Process

Chrome Custom Tabs

Page 22: ChromeとAndroidの過去・現在・未来

Setup Chrome Custom Tabs

Page 23: ChromeとAndroidの過去・現在・未来

Custom Tabs Support Library

Setup Chrome Custom Tabs

https://developer.android.com/tools/support-library/features.html#custom-tabs

Page 24: ChromeとAndroidの過去・現在・未来

Setup Chrome Custom Tabs

https://github.com/GoogleChrome/custom-tabs-client/tree/master/shared

Shared util module (Optional)

Page 25: ChromeとAndroidの過去・現在・未来

Chrome Custom Tabs Starter Kit

Setup Chrome Custom Tabs

https://github.com/operando/chrome-custom-tabs-starterkit

Page 26: ChromeとAndroidの過去・現在・未来

dependencies { compile 'com.android.support:customtabs:23.1.1' compile project(':shared') }

Setup Chrome Custom Tabs

Page 27: ChromeとAndroidの過去・現在・未来

Uri URI = Uri.parse("https://android.com/"); CustomTabsIntent tabsIntent = new CustomTabsIntent.Builder().build(); String package = CustomTabsHelper.getPackageNameToUse(this); tabsIntent.intent.setPackage(package); tabsIntent.launchUrl(this, URI);

Setup Chrome Custom Tabs

Page 28: ChromeとAndroidの過去・現在・未来

app to customize how Chrome looks and feels

Page 29: ChromeとAndroidの過去・現在・未来

Toolbar color Toolbar close button Enter and exit animations Add actions to the toolbar Add overflow menu

UI customization

Page 30: ChromeとAndroidの過去・現在・未来

CustomTabsIntent tabsIntent = new CustomTabsIntent.Builder() .setShowTitle(true) .setToolbarColor(0x77C159) .setStartAnimations(this, R.anim.slide_in_right, R.anim.slide_out_left) .setExitAnimations(this, R.anim.slide_in_left, R.anim.slide_out_right) .setCloseButtonIcon(back) .setActionButton(droid, "android", getActionButtonIntent()) .addMenuItem("android menu", getActionButtonIntent()) .build(); String package = CustomTabsHelper.getPackageNameToUse(this); tabsIntent.intent.setPackage(package); tabsIntent.launchUrl(this, Uri.parse("https://android.com/"));

UI customization

Page 31: ChromeとAndroidの過去・現在・未来

UI Customize

Page 32: ChromeとAndroidの過去・現在・未来

No Customize UI Customize

Page 33: ChromeとAndroidの過去・現在・未来

making the transition from app to web content fast

and seamless

Page 34: ChromeとAndroidの過去・現在・未来

optimized to load faster than WebViews and traditional

methods of launching Chrome

Page 36: ChromeとAndroidの過去・現在・未来
Page 37: ChromeとAndroidの過去・現在・未来

Warm up / Pre-fetch

Page 38: ChromeとAndroidの過去・現在・未来

Use Chrome features

Ssecurity Saved passwords Data Saver Shared cookie more features…

Page 39: ChromeとAndroidの過去・現在・未来

Chrome Custom Tabs can replace the WebView?

Page 40: ChromeとAndroidの過去・現在・未来

NO!!!!!!!!!!

Page 41: ChromeとAndroidの過去・現在・未来
Page 42: ChromeとAndroidの過去・現在・未来

Why?

Page 43: ChromeとAndroidの過去・現在・未来

Why?

細かいHandlingができない

+ 秘伝のWebChromeClient

+ 秘伝のWebViewClient

+ JavaScriptInterface

Page 44: ChromeとAndroidの過去・現在・未来

Why?

細かいHandlingができない

+ 秘伝のWebChromeClient

+ 秘伝のWebViewClient

+ JavaScriptInterface

Page 45: ChromeとAndroidの過去・現在・未来

Why?

CustomTabsCallback#onNavigationEventメソッドでページ(Tab)を

読み込み開始・終了、閉じた・開いた くらいのことなら通知してくれる

Page 46: ChromeとAndroidの過去・現在・未来

Best Practices for Custom Tabshttps://medium.com/google-developers/best-practices-for-

custom-tabs-5700e55143ee

Page 47: ChromeとAndroidの過去・現在・未来

Android Intents with Chrome

Page 48: ChromeとAndroidの過去・現在・未来

Android Intents with Chrome

ChromeがIntent SyntacなURLを

解釈してIntentを実行する

Page 49: ChromeとAndroidの過去・現在・未来

Android Intents with Chrome

<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="mercariapp" android:host="run\:" /> </intent-filter>

Page 50: ChromeとAndroidの過去・現在・未来

Android Intents with Chrome

<a href= “intent://run/#Intent; scheme=mercariapp;package=com.mercariapp.mercari; end”>

Run Mercari </a>

Page 51: ChromeとAndroidの過去・現在・未来

Android Intents with Chrome

https://developer.chrome.com/multidevice/android/intents

Page 52: ChromeとAndroidの過去・現在・未来

Debugging WebViews

Page 53: ChromeとAndroidの過去・現在・未来

Debugging WebViews

webView.setWebContentsDebuggingEnabled(true);

Android 4.4 以上

Page 54: ChromeとAndroidの過去・現在・未来

Debugging WebViews

Page 55: ChromeとAndroidの過去・現在・未来

Debugging WebViews

Page 56: ChromeとAndroidの過去・現在・未来

Web App Manifest

Page 57: ChromeとAndroidの過去・現在・未来

Define the metadata associated with

your web application in a JSON-based manifest.

Page 58: ChromeとAndroidの過去・現在・未来

name icons display theme_color background_color etc.

Manifest and its members

Page 59: ChromeとAndroidの過去・現在・未来

{ "name": "Google I/O 2015", "short_name": "I/O 2015", "display": "standalone", "icons": [{ "src": "images/touch/homescreen144.png", "sizes": "144x144", "type": "image/png" },…..], "gcm_sender_id": "608394197750", "gcm_user_visible_only": true }

Manifest by Google IO 2015

https://events.google.com/io2015/manifest.json

Page 60: ChromeとAndroidの過去・現在・未来

<link rel="manifest" href="manifest.json">

Manifest by Google IO 2015

view-source:https://events.google.com/io2015/

Page 61: ChromeとAndroidの過去・現在・未来

manifest HTTPS Service Worker visited your site twice over two separate days during the course of two weeks

App Install Banner

Page 62: ChromeとAndroidの過去・現在・未来

App Install Banner

Page 63: ChromeとAndroidの過去・現在・未来

Web Push Notification(GCM) Cache API Background Sync API etc.

Service Worker

Page 64: ChromeとAndroidの過去・現在・未来

スマートフォン体験を一歩先へ プログレッシブウェブアプリの作り方

https://docs.google.com/presentation/d/1VcXsKDaCUpf2SS35WNcrKslkK6PcXxWsnhcKiLfWCXs/

edit#slide=id.gf39949af9_0_0

by Google Eiji Kitamura

Page 65: ChromeとAndroidの過去・現在・未来

??

Page 66: ChromeとAndroidの過去・現在・未来

Web App Manifest Ⅱ

Web Technology

Page 67: ChromeとAndroidの過去・現在・未来

but

Page 68: ChromeとAndroidの過去・現在・未来

Native app install banner

Page 69: ChromeとAndroidの過去・現在・未来

similar to Web app install banners, but instead of adding to the home screen will let the user install your native app without leaving your site

Native app install banner

Page 70: ChromeとAndroidの過去・現在・未来

You have a web app manifest file

Site is served over HTTPS

The user has visited your site twice over two separate days during the course of two weeks

Criteria to Show the Banner

Page 71: ChromeとAndroidの過去・現在・未来

chrome://flags/#bypass-app-banner-

engagement-checks

Testing flag

Page 72: ChromeとAndroidの過去・現在・未来

{ "name": "Native app install banner Sample", "short_name": "Native app install banner Sample", "icons": [{ "src": "image/ic_android_black_48dp.png", "sizes": "144x144", "type": "image/png" }], "prefer_related_applications": true, "related_applications": [{ "platform": "play", "id": "com.kouzoh.mercari" }] }

Native app install banner manifest.json

Page 73: ChromeとAndroidの過去・現在・未来

Web App Manifest

https://www.w3.org/TR/appmanifest/

草案(Working Draft)

Page 74: ChromeとAndroidの過去・現在・未来

Native app Install Bannershttps://developers.google.com/web/fundamentals/engage-

and-retain/app-install-banners/native-app-install

Page 75: ChromeとAndroidの過去・現在・未来

App Stream

Page 76: ChromeとAndroidの過去・現在・未来

when Google finds in-app content that points to a mobile app you don’t

already have installed, it will offer you the option to

“stream” the app instead.

Page 77: ChromeとAndroidの過去・現在・未来

To run the application in the streaming

when application don’t have installed.

Page 78: ChromeとAndroidの過去・現在・未来

Streaming apps??

Page 79: ChromeとAndroidの過去・現在・未来

Very cool!!!!!!!!!!

Page 80: ChromeとAndroidの過去・現在・未来

http://3.bp.blogspot.com/-2Ats2zhc0HQ/Vkyq3JlcEiI/AAAAAAABBrA/hcfu4p02Fn4/s1600/app-stream-w-dots.gif

Page 81: ChromeとAndroidの過去・現在・未来

“This uses a new cloud-based technology that we’re

currently experimenting with”

http://insidesearch.blogspot.jp/2015/11/new-ways-to-find-and-stream-app-content.html

Page 82: ChromeとAndroidの過去・現在・未来

VMStreaming

Event(tap,scroll)

Streaming apps??

Page 83: ChromeとAndroidの過去・現在・未来

New ways to find (and stream) app content in Google Search

http://insidesearch.blogspot.jp/2015/11/new-ways-to-find-and-stream-app-content.html

Page 84: ChromeとAndroidの過去・現在・未来

Trial Run Ads

Page 85: ChromeとAndroidの過去・現在・未来

App ad format that lets a user play a game for up to 60 seconds by streaming

content from the app before downloading

Page 86: ChromeとAndroidの過去・現在・未来

http://2.bp.blogspot.com/-9v_0t2rKlzM/Vl-wzBxLs8I/AAAAAAAACGo/hU-Nndu-AIg/s1600/Trial%2BRun%2BAd%2Bgif%2Bfor%2BSGN.gif

Page 87: ChromeとAndroidの過去・現在・未来

Introducing new interactive ads to drive app installs

http://adwords.blogspot.jp/2015/12/trial-run-ads-interactive-interstitials-beta.html

Page 88: ChromeとAndroidの過去・現在・未来

Chrome Platform Status

https://www.chromestatus.com/features

Page 89: ChromeとAndroidの過去・現在・未来

ChromeとAndroidの

今後について

Page 90: ChromeとAndroidの過去・現在・未来

Thanks!!

Enjoy After Party!!