字幕组成品列表(Beta)
  • 写在前面
  • Android 平台
    • Game On! 游戏开发系列 - 031
      • Pie Noon - 1503060393
      • The Death of Base Game Activity - 1504030543
      • Surviving OpenGL Context Loss - 1504030546
      • WebP for Game Devs - 1504030547
      • Saved Games In-Depth (Part 1) - 1504070556
      • Saved Games In-Depth (Part 2) - 1504030548
      • Smaller Flipbook Textures with CRABBY - 1504030544
      • Google Tag Manager - 1504030545
      • Flatbuffers - 1505050794
      • Achievement Point Pointers - 1505050796
      • Frequency Scaling - 1505050797
      • Meet the Management APIs - 1501140367
      • Y U Ship Broken Games - 1505050795
    • Android 性能优化 - 088
      • Garbage Collection in Android - 1503170425
      • Performance Cost of Memory Leaks - 1503170424
      • Rendering Performance 101 - 1501130351
      • Understanding Overdraw - 1501130352
      • Understanding VSYNC - 1501130353
      • Tool - Profile GPU Rendering - 1501130354
      • Why 60fps? - 1501130355
      • Android UI and the GPU - 1501130356
      • Invalidations, Layouts, and Performance - 1501130357
      • Overdraw, Cliprect, QuickReject - 1501130358
      • Tool - Memory Monitor - 1501130363
      • Battery Performance 101 - 1501130364
      • Understanding Battery Drain on Android - 1501130365
      • Battery Drain and WakeLocks - 1501130366
      • Memory Performance 101 - 1504170661
    • I/O 2014 Android 开发专题 - 089
      • Activity Transitions - 1504020505
      • Building Apps For Android TV - 1504020520
      • Building great Android media experiences - 1504020510
      • Building a quality app from start to finish - 1504020515
      • App Indexing API - 1504020507
      • What's new in WebView - 1504010484
      • Bluetooth Low Energy - 1504010486
      • Building impressive Android media experiences - 1504010493
      • The next Generation of Authentication - 1504020497
      • Don't Alpha That Pixel! - 1504020523
      • NFC + HCE Your phone in an interactive world - 1504020509
      • Demystifying encodes and decodes of WebM - 1504020521
      • Google Cloud Messaging - 1504020524
      • Getting your Game on the Big Screen - 1504020518
      • I hear you like realtime memes - 1504020511
      • Offerize your App - 1504020506
      • Using the Android Job Scheduler - 1504020504
      • From Holo to Material - 1504020526
      • Under the Hood of Android Auto - 1504020501
      • Isolation for Android App Developers - 1504020498
      • Android Work - 1504010496
      • ExoPlayer: Adaptive video streaming on Android - 1504010489
      • Sample rates and resampling: Why can't we all just agree? - 1504010488
      • Drive Android API - 1504010485
    • Android Studio - 004
      • Layout Editor (Ep 3, Android Studio) - 1503290479
      • Introducing Gradle (Ep 2, Android Studio) - 1503170426
    • I/O 2014 Android 分发主题 - 091
      • Introduction to Google Play - 1504030534
      • Google Play: building your user community - 1504030535
      • Optimizing Apps for Education - 1504030536
      • Succeeding in Education Technology - 1504030530
      • Subscriptions Made Easy with Google Play - 1504030531
      • The world is your playground - go global with Google - 1504030533
      • Maximizing discoverability on Google Play - 1504030538
    • Android Auto - 003
      • Introduction to Android Auto - 1504130615
      • Android Auto Messaging - 1504130617
      • Android Auto Audio - 1504130616
    • Android Wear - 006
      • Designing for Android Wear - 1503210448
      • How We Customized Google Apps for Android Wear - 1503210450
      • Fullscreen apps for Android Wear - 1503210445
      • New Notification Features for Android Wear - 1503210446
      • Building Cloud-powered wearable Apps - 1503210449
      • An Introduction to Android Wear - 1503190435
      • Google I/O 2014 - Android Wear: The developer's perspective - 1503210442
      • Devoxx 2014 Interviews: Android Wear - 1503210440
      • DevBytes: Watch Faces for Android Wear - 1503210439
    • Android TV - 005
      • Using the Leanback library - 1504080588
      • Beach Buggy Racing Multiplayer with Nearby Connections (Play Services) - 1503060387
    • Android for Work - 106
      • Android for Work for Developers - 1503060390
      • App Configurations, Testing and Launchers - 1504110590
    • IO Bytes 2014 - Android - 066
      • Chrome Apps on Android and iOS - 1501080014
      • Perf Primer CPU, GPU and your Android game - 1501080017
  • Chrome 平台
    • IO Bytes 2014 - Chrome and Web - 067
      • Using the PageSpeed API - 1505070815
      • Fabulous Forms for the multi-device web - 1505070816
      • Testing multi-screen web pages - 1505070817
      • Responsive images today - 1505070819
      • Web Performance Testing at YouTube - 1505070828
      • Building sites for the multi-device web - 1505070820
      • Deep dive: Google Cloud Messaging for Chrome - 1505070827
  • Google 创业者资源
    • Coffee with a Googler - 012
      • Chat with Allen Huang of AndroidTV - 1503040384
      • Chat with Fred Chung about developer advocacy - 1503070395
      • Google Fit platform with Michelle Haq - 1503210443
      • Android Auto Product Manager Andrew Brenner - 1501120027
      • Chat with Francis Ma about Google Play services - 1501120028
    • Root Access For Startups - 077
      • What we learned building plug-ins for Android, with startup Magnet - 1503230453
      • How to use crowdfunding to your advantage, with startup Hale Devices - 1503280462
      • How to overcome customer objections when selling tech, with startup Guesswork - 1503280458
    • First Things First - 029
      • Getting started with Android: A crash-course in developing for Android - 1504120601
      • How to ask a question: conducting research for your startup - 1504120603
      • MVP Design Hacks: transform your hot idea into a validated prototype - 1504120602
      • Build something people want: Solving real problems - 1504120605
    • How I - 061
      • Use BigQuery to find my most valuable customers - 1504070573
      • Manage beta testing communities using Google Play - 1504070572
      • Use paper wireframing to build native prototypes - 1504070570
      • Used social media and $0 marketing to get 68 million users - 1504070568
      • Prep to fundraise with four questions - 1504070564
      • Validated my idea in 2 days (with no code) - 1504070562
      • Build open platforms on Android - 1504120596
      • Get cheap, automatic analytics for my business using BigQuery - 1504070571
      • Write press releases to get international media coverage - 1504070569
      • Test beta-product features using Google Apps - 1504070563
      • Use URL builder to measure ROI on social media - 1504070561
      • Use events to build DeadSocial's brand - 1504070557
      • Use BigQuery to visualize streaming data - 1503220452
      • Find, screen, and hire developers - 1503120406
      • Drive engagement with social challenges - 1504070558
  • 设计
    • DesignBytes - 017
      • Paper and Ink: The Materials that Matter - 1505050793
  • 云计算
    • DevBytes: Google Cloud Platform - 021
      • Powering the next killer app with the Google Cloud Platform - 1504210672
      • Introduction to Google Cloud Endpoints - 1504210675
      • The Beauty of Scale with Google Cloud Platform - 1504210678
    • Google Cloud Platform - Big Data - 105
      • GDELT & BigQuery: Understand the world - 1502200379
    • Uncategorized - 999
      • Introducing Google Cloud Platform Resources - 1501190370
  • Google 应用开发
    • Launchpad Online - 072
      • The Setup: Creating new apps using Google APIs - 1503190428
      • Listing your files in Google Drive - 1503190429
      • Customizing Google Analytics for your startup - 1503290473
      • The Launchpad Online series - 1503190427
      • Getting started with Google Analytics - 1503290472
      • Accessing Google Maps from a spreadsheet?!? - 1502220381
      • Change the world in 10 lines of code - 1503080398
    • Google Play Services - 054
      • Google Play services 6.1 - 1503290481
      • Google Play Services 7.0 - 1503200437
      • Google Play Services 6.5 - 1501080015
    • 谷歌地图 iOS SDK - 053
      • Maps Live: New Features in the Google Maps Mobile APIs for Android and iOS - 1504300777
    • Google 移动搜索开发 - 055
      • Is your app in the Google index? - 1504120598
      • Get more engaged users with Google Search for Developers - 1503070397
    • DevBytes: Google Cast - 020
      • Google Cast SDK for Android - 1504180666
      • Media Router Framework - Part 1 - Media Router API - 1504180667
      • Overview for Google Cast Receivers - 1504180664
      • Google Cast SDK for iOS - 1504180663
    • Getting Started with the Google Maps SDK for iOS - 035
      • Getting started with the Google Maps SDK for iOS, Part 1 - 1504270757
    • IO Bytes 2014 - Wearables - 070
      • Voice Driven GDK Glassware - 1505280836
    • Route 85 - 078
      • Introducing Route 85 - 1501120022
      • Quick Tip: Don't Default that Switch! - 1501190371
      • OpenInChrome on iOS, Part 1 - 1501120023
      • OpenInChrome on iOS, Part 2 - 1501120024
      • OpenInChrome on iOS, Part 3 - 1501120025
      • OpenInChrome on iOS, Part 4 - 1501120026
    • DevBytes 2014 - 019
      • Web Components - Template - 1505040789
      • Wearable DataLayer API - 1505050792
      • Using srcset for responsive images - 1505050790
      • The picture element for art direction - 1505050791
    • Uncategorized - 999
      • Sun Surveyor brings augmented reality to photographers using Google Maps APIs - 1504200668
      • Snappy travels with the Roads API - 1503060392
      • Easy Maps Apps in Java and Python - 1501140030
  • Google 广告平台
  • Polymer
    • Polycasts - 076
      • The Awesome Power of Auto-Binding Templates -- Polycasts #08 - 1502220382
      • Content Switcheroo with Core-Pages -- Polycasts #09 - 1502200380
      • Core Iconset -- Polycasts #02 - 1505040788
  • Web 平台
    • HTTP 203 - 062
      • Gotchas - 1501140368
      • Font Rendering - 1501080016
    • Web Components - 081
      • DevBytes: Web Components - Overview - 1504250709
  • 宣传视频
    • Uncategorized - 999
      • Google Developers - 1501150369
      • I/O Extended 2014 - Join me - 1502220383
  • Google 各类开发者会议
    • 2014 Chrome 开发者高峰会议 - 009
      • Keynote - Chrome Dev Summit 2014 (Darin Fisher) - 1503120407
      • TLS All the Things! - Security with Performance(Chris Palmer) - 1503140412
      • Let’s build some apps with Polymer!(Rob Dodson) - 1503150415
      • Day One Closing Remarks(Sundar Pichai) - 1503150417
      • Chrome Leadership panel - 1503160422
      • Fundamentals of Mobile Web Development(Matt Gaunt) - 1503150416
    • 2015 游戏开发者大会中 - 039
      • FlatBuffers - 1504150640
      • Games for Google Cast - 1504150637
      • Top 10 Things Android Game Developers Should Know v 3.0 - 1504150643
      • Automate Publishing for Google Play APIs - 1504150639
      • 3 Game Design Mistakes You're Making - 1504150636
      • Android TV - 1504150638
      • How to Go Viral Without Really Trying - 1504150641
    • Devoxx 2014 Interviews - 024
      • What's new in Android 5.0 Lollipop - 1504260740
      • Android Tools - 1504260743
      • BigQuery and user-defined functions - 1504260744
    • IO Bytes 2014 - 065
      • Dart in Google Cloud - 1505070810
      • Big genomic data on Google Cloud Platform - 1505070811
      • Easy International Checkout with Chrome - 1505070802
      • Google developer tools and APIs for iOS - 1503190436
      • Whet your appetite with IO Bytes - 1501080021
    • PlayTime@Shanghai - 095
      • 主题演讲 Chris Yerga - 1504060549
      • 如何成功地开发你的应用 Ellie Powers - 1504060550
      • 在Google上营利 Brahim Elbouchikhi - 1504060551
      • Playtime Shanghai event sizzle reel - 1504070552
    • Project Google I/O 2015 - 098
      • Project Tango Mobile 3D tracking and perception - 1506120857
      • Democratizing Education - 1506120868
      • Improve your Android app’s accessibility - 1506120864
      • Google Cloud Messaging 3.0 - 1506120844
      • Developers connecting the world through Google Play - 1506120862
  • 开源开放技术
    • Compressor Head - 013
      • The Trailer, Season 2 - 1503060385
      • Behind the Scenes - 1503210441
      • Arithmetic Compression (Ep 5, Compressor Head) Google - 1503070394
      • Introducing Compressor Head - 1502120372
      • Episode 1 (Variable Length Codes) - 1502120373
      • Episode 2 (The LZ77 Compression Family) - 1502120374
      • Episode 3 (Markov Chain Compression) - 1502120375
Powered by GitBook
On this page
  • 译者信息
  • 解说词中文版:

Was this helpful?

  1. Google 应用开发
  2. Route 85 - 078

OpenInChrome on iOS, Part 1 - 1501120023

PreviousQuick Tip: Don't Default that Switch! - 1501190371NextOpenInChrome on iOS, Part 2 - 1501120024

Last updated 5 years ago

Was this helpful?

视频发布时间

2014年12月18日

视频介绍

视频推介语

暂无,待补充。

译者信息

翻译

润稿

终审

原始链接

中文字幕

翻译流水号

加入字幕组

鲁登科

周亿、程路

——

1501120023

解说词中文版:

欢迎来到我们Route 85系列视频的第一期

我们的视频是为iOS开发者量身定做的

你们闻到了吗

新事物的味道

太棒了

可能你已经知道多年以前 Chrome浏览器

就已经有iOS版本了

但是不能选择你的默认浏览器

因此如果你使用iOS

并且和我一样是的Chrome常客

你可能在chrome上有一堆标签

那是因为你每天都用的浏览器

但是你也有一些页面是在Safari浏览器上打开的

因为当你点击另一个应用程序上的链接时

它会打开自己的默认浏览器

但是在这里我要向你展示一些东西

看看这些

我在这里使用我喜爱的Twitter客户端Tweetbot

如果你没有见过那么这是我强烈推荐的

这里是Colt McAnlis的日志

中的一个链接

当我点击它的时候它会如你预料的在Safari上打开

现在让我们返回Tweetbot

进入我的偏好设置

你会注意到这儿的一个设置选项

是修改我的默认浏览器

其中一个选项就是Chrome

我们选择这个

让我们回到之前的页面

看看当我点击这个相同的链接会发生什么

现在它是在Chrome上打开的

还有其他的24个我已经打开的标签

我打开过很多标签页

顺带一提 这也给我带来很多其他的便利

如果你的Chrome浏览器为你保存过

某些网站的登陆信息的话 比如桌面版浏览器

我就能够方便地登陆而不用输入密码

如果你看一下Chrome的设置选项

你会发现这边我启用了 减少流量消耗

的功能 这样一来

如果我用移动网络浏览网页时

他会减少页面大小来减少流量消耗

它当然如果这个页面显示的是另一种语言

Chrome会帮我将它翻译过来

当然 如果我想在电脑上看这篇文章的话

我可以把这个页面加入书签

这样就可以在电脑浏览器上看到了哈

但是我认为其中最方便的地方

尤其是对我们这些应用程序开发者而言

就是Chrome上这些好使的后退按钮

当我点击它们时会立刻返回我的Tweetbot应用程序

上次浏览的地方

因此我可以继续查看我的Twitter消息

那么这个软件是怎么做到的呢

尽管我没有看过它们的源代码

但是这个功能 我有一个比较好的解决方案

这里使用了iOS中叫做URL Schemes的技术

也就是当你打开一个URL时

就像画面上的这样

iOS会检索分号前的这一小段文字

它决定了应该打开哪个程序

来处理剩下的URL

例如在第一个例子中

mailto会打开iOS的邮件程序

同样的 tel会打开拨号键盘

HTTP或HTTPS会打开Safari浏览器

一种很特殊的情况是iOS会把任以

maps.apple.com开头的链接直接用

Apple's Maps打开 作为第三方开发者我们不能

修改应用程序打开邮件 网站 或者是电话的URL Schemes

但是我们可以声明我们自己的Schemes

我们可以声明一个URL Schemes

以我们应用程序声明的字符串作为开头

当用户尝试打开

此类URL时 我们的程序就会被打开

系统会传递URL给appDelegate方法进行处理

我们可以创建一个应用程序

并声明这程序使用foo做标识

事实上 我们之后会教你怎么实现这些

现在我们需要知道的一个重点是

Google Chrome和Maps

和许多其他的第三方应用

已经申请了他们自己的URL方案

你可以利用这些

在Chrome上直接打开一个URL

让我们看看怎么做

我们从设计一个简单的程序开始

录视频的时候 Swift和Xcode 6还在测试

所以我使用的是Objective-C和Xcode 5

如果你们有很多人都感兴趣

我也可以在Swift上重复这些步骤

防止掉节操

这里我准备建立一个新工程

选择单视图应用程序Single View Application

把它命名为OpeninChromeExample

因为我从一开始就很喜欢这名字

为了简单起见 选择iPhone程序

随便找个喜欢的地方保存

现在 让我们打开storyboard

我要添加一个按钮 叫做

叫做打开一个网站Open a web page

居中

好了 看看这个程序

漂亮吗

这东西太美了

真的

这里我得打开我的辅助编辑器

按住control把按钮拖进源代码中

创建一个新的Action命名为openWebPageWasPressed

现在我要声明一个NSURL

将其命名为googleURL

等于NSURL URLWithString

如果你对Google主页感到视觉疲劳

你可以随便用一个你喜欢的网页代替它

然后我要使用UIApplication sharedApplication

调用openURL我要使用这打开googleURL

好了

没问题 让我们保存一下

当我运行这个程序并点击这个按钮时

好了 它会在Safari上打开Google主页

这是因为我尝试打开的URL

是以https开头

iOS自动使用Safari浏览器打开

让我们回到程序上

在主编辑器上编辑ViewController.m

让我们看看当我用googlechrome

代替https的时候会发生什么

当我运行这些并且点击这个按钮

啊 什么也没发生

这是因为我是在模拟器运行

这上面我没安装Chrome

现在这也是我应该考虑到的一种情况

假设用户没有安装Chrome

那么我们就应该使用Safari

随后我们再讨论

现在我们先停止这个程序

我要从模拟器切换

到我iPhone真机上运行

现在如果你点击这个按钮

我们可以看见 没错

我的URL在Chrome上打开了

欧耶

坦白讲 这是最基本

你需要做的事情 就是把http替换成

googlechrome 那么https换成啥呢

我想应该是googlechromes来通过加密协议打开

瞧 你所有的链接现在都在Chrome上打开

在未安装Chrome的模拟器上

我们的应用程序的运行情况是啥呢

很明显当我点击按钮时没任何反应

这是很糟糕的用户体验

最起码 我应该检查这种情况

然后Safari上打开这个链接

想实现这个功能很简单

UIApplications除了有openURL这个方法之外

它还有一个Bool返回值的canOpenURL方法

就是通过系统判断一下

看看是否有应用程序

可以响应这种URL Scheme

因此我回到按钮处理方法

我准备建两个URL

第一个命名为mySafariURL

这儿用NSURL URLWithstring

这里我们只使用简单的HTTPS作为URL Scheme

将这一个变量重命名为chromeURL

并且这里我们使用googlechromes URL Scheme

接下来我会进行判断

如果能够使用chrome打开

那么就用chrome打开

否则 我们使用默认 我想是退一步

使用Safari

这次的应用程序应该在

在模拟器上会正常运行

我点击一下网页打开按钮

它在Safari上打开了Google主页面

并且当我选择真机编译的时候

当我点击这个按钮

它的确就在Chrome上打开了

很赞啊有木有

但我还是想探索一下

那些我们还不知道的功能

就是那个对我们开发者都很有用的

能够在Chrome上添加一个小巧的返回按钮

让用户返回你的应用程序

这看起来仅仅是一个小的细节

但是点击直接返回你的应用程序

就相当于双击home键

从多任务中选择你的应用程序返回

这让我有更加顺滑的体验

下节课 我会教你如何去做的

紫薇别肘

Learn how to open a web link in Chrome on iOS! Follow along with this series of screencasts, where we explain how URL schemes work and demonstrate how iOS uses them to open up specific applications. Then, you create your own app to open up a web page in both Safari and Chrome.Route 85 playlist: to the Google Developers channel here:

这我们使用

https://goo.gl/iR6GQiSubscribe
http://goo.gl/mQyv5L
https://www.google.com
Youtube
Youtube
加入 GDG 字幕组
video_screenshot