字幕组成品列表(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 2 - 1501120024

PreviousOpenInChrome on iOS, Part 1 - 1501120023NextOpenInChrome on iOS, Part 3 - 1501120025

Last updated 5 years ago

Was this helpful?

视频发布时间

2014年12月18日

视频介绍

Using the x-callback-url format. In part 2 of this screencast series, we show you how to use the x-callback-url standard within iOS to create a back button in Chrome that points back to your application.

视频推介语

暂无,待补充。

译者信息

翻译

润稿

终审

原始链接

中文字幕

翻译流水号

加入字幕组

鲁登科

周亿、程路

——

1501120024

解说词中文版:

欢迎回到Route85 我们的节目是为iOS开发者打造的

因为我们同样喜爱你们

本期视频是关于如何在iOS设备上用Chrome浏览器

打开网页系列视频的第二个部分

在以前的视频中我曾向你展示过

如何检测用户是否安装了Chrome和如何打开Chrome浏览器

但是这里我要探索另一个我们目前不知道的功能

这可能是对程序员来说非常重要的功能

在Chrome上添加一个小返回按钮让用户可以返回应用程序

我知道它看起只是个很小的功能

但是只通过一个点击回到你应用程序上而不需要Multitasker

这是很炫的

现在Chrome已经在利用这种在iOS开发界被称作

x-callback-url的新兴技术来实现这个功能

这是一个应用程序间有双向通信的约定

你基本要做的是建立一个自定义方案

告诉目标应用的你自己的应用是什么

这样当用户在目标应用中做完他们需要做完的事

目标应用能够通过自定义方案打开一个新的URL返回之前的应用

整个过程其实是非常灵巧

那么它实际上是什么样子的呢

来看看我们的Google Chrome URL吧

就是这个

这是非常基础的

但是现在我并不让它打开www.google.com

我要让它打开x-callback-url

基本上就是给Google Chrome一个信号 嘿

我要给你一些x回调协议的信息 这样你做完工作之后就能返回我这了

在那之后 我要添加一个方法 然后传递一个URL参数叫做url

也就是我们要访问的那个 或者更准确的说 URL编码版本

最终你会得到一些像这样的东西

现在如果我打开这个URL 它也会生效

我们现在就在我们的示例应用程序上试试

现在我要回到了OpenInChromeExample程序上

和SafariURL和ChromeURL一样

我要声明一个新的URL并将其命名为callbackURL

看上去和chrome那个相当类似

但是我这的string是googlechromes

后面我的host 我要使用x-callback-url

现在 只剩下一小部分工作 因为我需要 啊

xcode 我知道我需要一个分号 因为我只需要修改这三个字符

让我们来修改一下

这应该是%3A%2F%2F

有没有人知道Xcode是否会自动进行URL转义

如果有的话记得在评论中告诉我

最后 我要确保我将这的ChromeURL换成了callbackURL

如果我的URL编写正确的话我觉得它一定很棒

会吗

我们来将它修改一下

选择编辑范围为所有

将这个改为URL

这样更好了

现在我可以在我的设备上运行它了

当我点击这个按钮时 我们可以看见我的URL在Chrome中打开

但是现在任然没有返回按钮指向你的应用程序

这是因为我们还没有告诉Chrome任何关于这个访问它的程序的信息

为了实现这个功能我们需要注册我们自己的URL方案

像Chrome声明它打开任何以googlechrome开始的URL方案一样

我们也可以为我们的示例应用程序声明自定义URL方案

我们现在就做

我们回到Xcode

我们打开工程文件然后查看生成目标

在信息栏下底部位置 有一个URL types选项

这是我们的程序可以声明URL方案的地方

我们展开这里

这里现在并没有任何方案

我们可以点加号添加一个

这里的标识符是可读版本的URL方案

我知道的大多数开发者应该会在这里捆绑ID

我想我也可以这么做

因此填上com.google.openinchromeexample

当然你可以用任何对适合你组织的ID代替com.google

这里的URL方案 就是分号之前的目标程序 我们要声明的URL方案

这应该是唯一的 不能重复

如果你的程序和Chrome或者Google Maps一样被很多第三方程序调用

你也可以考虑使用应用名或者稍加变换

但是你如果真的只是像我们一样只需要告诉目标应用

自己的URL方案而不指望很多的第三方软件开发者知道

那么我认为最保险的捆绑ID 省时间

所以我们这样填写comgoogleopeninchromeexample

我得确保我的拼写正确

看起来不错

我将它复制一下 因为等会会用到

现在我们已经声明任何以comgoogleopeninchromeexample:

开头的URL会在此程序中打开

我们既然已经搞定了 可以回到我们的callback URL上了

现在我要打开ViewController.m

这里就是我们的callback URL

我们要对它做些修改

我换一行继续写因为这句太长了

首先我们要做的是添加&x-source=My App argument

这是我们应用程序的可读版本名

在Chrome中它会使用这个值来决定在后退按钮中显示什么文本

同样 我们要进行URL转义

我要用%20代替它

下一步我要添加一句x-success

x-callback是当用户完成他们想要做的事情之后

我们的目标程序尝试正常跳转回应用时打开的URL

要注意的是在Chrome中它会使用这个URL

不管你是否已经打开这个页面或者是否得到404结果或者是其他情况

始终是作为一个可用值

这个参数的值我们应该用指向应用程序的URL 也就是我们的自定义方案

幸好我刚刚复制了

我将它粘贴在这里

就是comgoogleopeninchromeexample

末尾会有一个冒号

再次提醒冒号这里需要转义

要它改为%3A

现在我们的URL看起来很长

又是x-source又是x-success

让我们尝试运行看看会发生什么

我现在点击这个按钮

看这儿

它在Chrome打开了

现在这里有了返回按钮

这个标题是My App 和我们在资源中定义的相同

当我们点击它的时候 它就会回到我们的应用程序

太酷了

如果你发现你的Chrome上并没有一个返回按钮

最常见的原因是你添加的x-success和

你在URL类型中URL方案不一样

Chrome会执行它自己的[UIApplicaton canOpenURL]

来决定是否在首栏显示按钮

如果你的x-success参数和URL参数不匹配

它会说不 我无法打开那个URL

那么它就不显示这个按钮

让我们回顾一下这个复杂的URL

开头的googlechrome URL方案是要求打开Chrome浏览器的

x-callback URL告诉Chrome这是x-callback类型的URL

open加上之后的URL参数告诉Chrome实际应该打开哪个页面

当x-success参数告诉Chrome操作完成之后

应该打开什么URL方案

最终x-source参数告诉Chrome在小按钮中显示什么

虽然这些都很棒

但是我们还没有完成

事实上我们之前所做的 如果Chrome版本非常的老 根本不会生效

虽然这种情况看起来不太可能 但它真的会发生

让我们面对现实

我们的代码看起来可能有些混乱 甚至会混乱我们以前的成果

但是不要担心

我们会在下节课中解决这些问题

继续观看吧

执行动作是打开 然后输入url=

https://www.google.com
Youtube
Youtube
加入 GDG 字幕组
video_screenshot