Seamless Linking to Your App

Seamless Linking to Your App

An Android app is usually only a single part of a larger product. Indeed, a product is usually made of several independent entities such as a website, one or several mobile apps, etc.

In this talk, we will learn how to increase app engagement and tear down the walls between your website and your apps. You will also discover how you can give your users the most integrated mobile experience possible with features such as Related Apps Banner, Smart Lock for Passwords and more… In a nutshell, this talk is all about driving users to your mobile app and making your product successful.

E9bf8f6d5480ea2a2623df7dccfd1f70?s=128

Cyril Mottier

November 10, 2016
Tweet

Transcript

  1. 12.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter>
  2. 13.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <action android:name="android.intent.action.VIEW" />
  3. 14.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />
  4. 15.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <data android:scheme="https" android:host="www.trainline.eu" />
  5. 16.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <data android:path="/search" /> <data android:pathPrefix="/search/" />
  6. 17.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> Are you f***ing serious? The real world is that simple?
  7. 18.

    <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="https" android:host="www.trainline.eu" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> Nope…
  8. 19.

    <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="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter>
  9. 20.

    <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="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:scheme="https" />
  10. 21.

    <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="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> <data android:scheme="http" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" />
  11. 22.

    public final class AppConfig { private AppConfig() { } public

    static final List<String> SCHEMES = Collections.unmodifiableList(Arrays.asList( "http", "https")); public static final List<String> AUTHORITIES = Collections.unmodifiableList(Arrays.asList( "captaintrain.com", "trainline.de", "trainline.es", "trainline.eu", "trainline.fr", "trainline.it", "www.captaintrain.com", "www.trainline.de", "www.trainline.es", "www.trainline.eu", "www.trainline.fr", "www.trainline.it")); public static final String PATH_SEARCH = "search"; }
  12. 23.

    public final class SearchActivity extends Activity { @Override protected void

    onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String departure = null; String arrival = null; final Uri uri = getIntent().getData(); if (uri != null) { if (AppConfig.AUTHORITIES.contains(uri.getAuthority()) && AppConfig.SCHEMES.contains(uri.getScheme())) { final List<String> segments = uri.getPathSegments(); if (segments != null && segments.size() == 3 && AppConfig.PATH_SEARCH.equals(segments.get(0))) { arrival = segments.get(1); departure = segments.get(2); } } } startSearch(departure, arrival); } }
  13. 24.

    public final class SearchActivity extends Activity { @Override protected void

    onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String departure = null; String arrival = null; final Uri uri = getIntent().getData(); if (uri != null) { if (AppConfig.AUTHORITIES.contains(uri.getAuthority()) && AppConfig.SCHEMES.contains(uri.getScheme())) { final List<String> segments = uri.getPathSegments(); if (segments != null && segments.size() == 3 && AppConfig.PATH_SEARCH.equals(segments.get(0))) { arrival = segments.get(1); departure = segments.get(2); } } } startSearch(departure, arrival); } } if (AppConfig.AUTHORITIES.contains(uri.getAuthority()) && AppConfig.SCHEMES.contains(uri.getScheme())) {
  14. 25.

    public final class SearchActivity extends Activity { @Override protected void

    onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String departure = null; String arrival = null; final Uri uri = getIntent().getData(); if (uri != null) { if (AppConfig.AUTHORITIES.contains(uri.getAuthority()) && AppConfig.SCHEMES.contains(uri.getScheme())) { final List<String> segments = uri.getPathSegments(); if (segments != null && segments.size() == 3 && AppConfig.PATH_SEARCH.equals(segments.get(0))) { arrival = segments.get(1); departure = segments.get(2); } } } startSearch(departure, arrival); } } final List<String> segments = uri.getPathSegments(); if (segments != null && segments.size() == 3 && AppConfig.PATH_SEARCH.equals(segments.get(0))) { arrival = segments.get(1); departure = segments.get(2); }
  15. 26.

    public final class SearchActivity extends Activity { @Override protected void

    onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String departure = null; String arrival = null; final Uri uri = getIntent().getData(); if (uri != null) { if (AppConfig.AUTHORITIES.contains(uri.getAuthority()) && AppConfig.SCHEMES.contains(uri.getScheme())) { final List<String> segments = uri.getPathSegments(); if (segments != null && segments.size() == 3 && AppConfig.PATH_SEARCH.equals(segments.get(0))) { arrival = segments.get(1); departure = segments.get(2); } } } startSearch(departure, arrival); } } startSearch(departure, arrival);
  16. 27.
  17. 28.
  18. 29.
  19. 31.
  20. 32.
  21. 33.
  22. 34.
  23. 35.
  24. 36.
  25. 37.

    Available on Marshmallow+ (API 23) Consider app & website as

    a single entity Prevent “Open with” dialog
  26. 38.

    Available on Marshmallow+ (API 23) Consider app & website as

    a single entity Prevent “Open with” dialog
  27. 39.

    Available on Marshmallow+ (API 23) Consider app & website as

    a single entity Prevent “Open with” dialog
  28. 40.

    <activity ...> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />

    <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> </activity>
  29. 41.

    <activity ...> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />

    <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> </activity> <action android:name="android.intent.action.VIEW" />
  30. 42.

    <activity ...> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />

    <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> </activity> <category android:name="android.intent.category.BROWSABLE" />
  31. 43.

    <activity ...> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />

    <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> </activity> <data android:scheme="http" /> <data android:scheme="https" />
  32. 44.

    <activity ...> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />

    <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="captaintrain.com" /> <data android:host="trainline.de" /> <data android:host="trainline.es" /> <data android:host="trainline.eu" /> <data android:host="trainline.fr" /> <data android:host="trainline.it" /> <data android:host="www.captaintrain.com" /> <data android:host="www.trainline.de" /> <data android:host="www.trainline.es" /> <data android:host="www.trainline.eu" /> <data android:host="www.trainline.fr" /> <data android:host="www.trainline.it" /> <data android:path="/search" /> <data android:pathPrefix="/search/" /> </intent-filter> </activity> android:autoVerify="true"
  33. 53.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ]
  34. 54.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] "relation": [ "delegate_permission/common.handle_all_urls" ],
  35. 55.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] "namespace": "android_app",
  36. 56.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] "package_name": "com.capitainetrain.android",
  37. 57.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ]
  38. 58.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ]
  39. 61.
  40. 62.
  41. 63.
  42. 64.
  43. 65.
  44. 67.
  45. 68.
  46. 69.

    Available on Chrome 44+ Knows whether an app is installed

    Easy to add to your website Displayed when appropriate
  47. 70.

    Available on Chrome 44+ Knows whether an app is installed

    Easy to add to your website Displayed when appropriate
  48. 71.

    Available on Chrome 44+ Knows whether an app is installed

    Easy to add to your website Displayed when appropriate
  49. 72.

    Available on Chrome 44+ Knows whether an app is installed

    Easy to add to your website Displayed when appropriate
  50. 76.

    {
 "display": "browser",
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",


    "type": "image/png"
 }
 ],
 "name": "Trainline EU",
 "prefer_related_applications": true,
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
 "short_name": "Trainline EU"
 }

  51. 77.

    {
 "display": "browser",
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",


    "type": "image/png"
 }
 ],
 "name": "Trainline EU",
 "prefer_related_applications": true,
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
 "short_name": "Trainline EU"
 }
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",
 "type": "image/png"
 }
 ],
  52. 78.

    {
 "display": "browser",
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",


    "type": "image/png"
 }
 ],
 "name": "Trainline EU",
 "prefer_related_applications": true,
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
 "short_name": "Trainline EU"
 }
 "short_name": "Trainline EU"
  53. 79.

    {
 "display": "browser",
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",


    "type": "image/png"
 }
 ],
 "name": "Trainline EU",
 "prefer_related_applications": true,
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
 "short_name": "Trainline EU"
 }
 "prefer_related_applications": true,
  54. 80.

    {
 "display": "browser",
 "icons": [
 {
 "src": "../favicons/android-icon-3x.png",
 "sizes": "144x144",


    "type": "image/png"
 }
 ],
 "name": "Trainline EU",
 "prefer_related_applications": true,
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
 "short_name": "Trainline EU"
 }
 "related_applications": [
 {
 "platform": "play",
 "id": "com.capitainetrain.android"
 }
 ],
  55. 83.

    The user has visited your site twice over two separate

    days during the course of two weeks
  56. 84.

    The user has visited your site twice over two separate

    days during the course of two weeks There is a dev option for that…
  57. 85.

    The user has visited your site twice over two separate

    days during the course of two weeks There is a dev option for everything…
  58. 86.

    The user has visited your site twice over two separate

    days during the course of two weeks There is a dev option chrome://flags/#bypass-app-banner-engagement-checks for everything…
  59. 87.
  60. 88.
  61. 89.
  62. 90.
  63. 93.

    private final GoogleApiClient.ConnectionCallbacks mConnectionCallbacks = new GoogleApiClient.ConnectionCallbacks() { @Override public

    void onConnected(Bundle connectionHint) { final CredentialRequest request = new CredentialRequest.Builder(). setPasswordLoginSupported(true). build(); Auth.CredentialsApi.request(mCredentialsClient, request). setResultCallback(mRequestCallback); } @Override public void onConnectionSuspended(int cause) { // ... } }; private ResultCallback<CredentialRequestResult> mRequestCallback = new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { if (result.getStatus().isSuccess()) { onCredentialRetrieved(result.getCredential()); } else { resolveResult(result.getStatus()); } } };
  64. 94.

    private final GoogleApiClient.ConnectionCallbacks mConnectionCallbacks = new GoogleApiClient.ConnectionCallbacks() { @Override public

    void onConnected(Bundle connectionHint) { final CredentialRequest request = new CredentialRequest.Builder(). setPasswordLoginSupported(true). build(); Auth.CredentialsApi.request(mCredentialsClient, request). setResultCallback(mRequestCallback); } @Override public void onConnectionSuspended(int cause) { // ... } }; private ResultCallback<CredentialRequestResult> mRequestCallback = new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { if (result.getStatus().isSuccess()) { onCredentialRetrieved(result.getCredential()); } else { resolveResult(result.getStatus()); } } }; public void onConnected(Bundle connectionHint) { final CredentialRequest request = new CredentialRequest.Builder(). setPasswordLoginSupported(true). build(); Auth.CredentialsApi.request(mCredentialsClient, request). setResultCallback(mRequestCallback); }
  65. 95.

    private final GoogleApiClient.ConnectionCallbacks mConnectionCallbacks = new GoogleApiClient.ConnectionCallbacks() { @Override public

    void onConnected(Bundle connectionHint) { final CredentialRequest request = new CredentialRequest.Builder(). setPasswordLoginSupported(true). build(); Auth.CredentialsApi.request(mCredentialsClient, request). setResultCallback(mRequestCallback); } @Override public void onConnectionSuspended(int cause) { // ... } }; private ResultCallback<CredentialRequestResult> mRequestCallback = new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { if (result.getStatus().isSuccess()) { onCredentialRetrieved(result.getCredential()); } else { resolveResult(result.getStatus()); } } }; if (result.getStatus().isSuccess()) { onCredentialRetrieved(result.getCredential()); } else { resolveResult(result.getStatus()); }
  66. 96.

    private void onCredentialRetrieved(Credential credential) { Auth.CredentialsApi.disableAutoSignIn(mCredentialsClient); signIn(credential.getId(), credential.getPassword()); } private

    void resolveResult(Status status) { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(SmartLockActivity.this, RC_SLP_READ); } catch (IntentSender.SendIntentException e) { // Fail silently } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SLP_READ: if (resultCode == RESULT_OK) { onCredentialRetrieved(data.<Credential>getParcelableExtra(Credential.EXTRA_KEY)); } break; } }
  67. 97.

    private void onCredentialRetrieved(Credential credential) { Auth.CredentialsApi.disableAutoSignIn(mCredentialsClient); signIn(credential.getId(), credential.getPassword()); } private

    void resolveResult(Status status) { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(SmartLockActivity.this, RC_SLP_READ); } catch (IntentSender.SendIntentException e) { // Fail silently } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SLP_READ: if (resultCode == RESULT_OK) { onCredentialRetrieved(data.<Credential>getParcelableExtra(Credential.EXTRA_KEY)); } break; } } private void onCredentialRetrieved(Credential credential) { Auth.CredentialsApi.disableAutoSignIn(mCredentialsClient); signIn(credential.getId(), credential.getPassword()); }
  68. 98.

    private void onCredentialRetrieved(Credential credential) { Auth.CredentialsApi.disableAutoSignIn(mCredentialsClient); signIn(credential.getId(), credential.getPassword()); } private

    void resolveResult(Status status) { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(SmartLockActivity.this, RC_SLP_READ); } catch (IntentSender.SendIntentException e) { // Fail silently } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SLP_READ: if (resultCode == RESULT_OK) { onCredentialRetrieved(data.<Credential>getParcelableExtra(Credential.EXTRA_KEY)); } break; } } private void resolveResult(Status status) { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(SmartLockActivity.this, RC_SLP_READ); } catch (IntentSender.SendIntentException e) { // Fail silently } } }
  69. 99.

    private void onCredentialRetrieved(Credential credential) { Auth.CredentialsApi.disableAutoSignIn(mCredentialsClient); signIn(credential.getId(), credential.getPassword()); } private

    void resolveResult(Status status) { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(SmartLockActivity.this, RC_SLP_READ); } catch (IntentSender.SendIntentException e) { // Fail silently } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SLP_READ: if (resultCode == RESULT_OK) { onCredentialRetrieved(data.<Credential>getParcelableExtra(Credential.EXTRA_KEY)); } break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SLP_READ: if (resultCode == RESULT_OK) { onCredentialRetrieved(data.<Credential>getParcelableExtra(Credential.EXTRA_KEY)); } break; } }
  70. 100.
  71. 101.

    private void saveCredential(String email, String password) { final Credential credential

    = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.save(mCredentialsClient, credential). setResultCallback(mSavedCallback); } private final ResultCallback<Status> mSavedCallback = new ResultCallback<Status>() { @Override public void onResult(final Status status) { final Activity ziss = SmartLockActivity.this; if (status.isSuccess()) { Toast.makeText(ziss, "Your login credentials have been saved", Toast.LENGTH_LONG).show(); } else { if (status.hasResolution()) { try { status.startResolutionForResult(ziss, RC_SLP_WRITE); } catch (IntentSender.SendIntentException e) { // Fail silently } } } } };
  72. 102.

    private void saveCredential(String email, String password) { final Credential credential

    = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.save(mCredentialsClient, credential). setResultCallback(mSavedCallback); } private final ResultCallback<Status> mSavedCallback = new ResultCallback<Status>() { @Override public void onResult(final Status status) { final Activity ziss = SmartLockActivity.this; if (status.isSuccess()) { Toast.makeText(ziss, "Your login credentials have been saved", Toast.LENGTH_LONG).show(); } else { if (status.hasResolution()) { try { status.startResolutionForResult(ziss, RC_SLP_WRITE); } catch (IntentSender.SendIntentException e) { // Fail silently } } } } }; private void saveCredential(String email, String password) { final Credential credential = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.save(mCredentialsClient, credential). setResultCallback(mSavedCallback); }
  73. 103.

    private void saveCredential(String email, String password) { final Credential credential

    = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.save(mCredentialsClient, credential). setResultCallback(mSavedCallback); } private final ResultCallback<Status> mSavedCallback = new ResultCallback<Status>() { @Override public void onResult(final Status status) { final Activity ziss = SmartLockActivity.this; if (status.isSuccess()) { Toast.makeText(ziss, "Your login credentials have been saved", Toast.LENGTH_LONG).show(); } else { if (status.hasResolution()) { try { status.startResolutionForResult(ziss, RC_SLP_WRITE); } catch (IntentSender.SendIntentException e) { // Fail silently } } } } }; if (status.isSuccess()) { Toast.makeText(ziss, "Your login credentials have been saved", Toast.LENGTH_LONG).show(); }
  74. 104.

    private void saveCredential(String email, String password) { final Credential credential

    = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.save(mCredentialsClient, credential). setResultCallback(mSavedCallback); } private final ResultCallback<Status> mSavedCallback = new ResultCallback<Status>() { @Override public void onResult(final Status status) { final Activity ziss = SmartLockActivity.this; if (status.isSuccess()) { Toast.makeText(ziss, "Your login credentials have been saved", Toast.LENGTH_LONG).show(); } else { if (status.hasResolution()) { try { status.startResolutionForResult(ziss, RC_SLP_WRITE); } catch (IntentSender.SendIntentException e) { // Fail silently } } } } }; if (status.hasResolution()) { try { status.startResolutionForResult(ziss, RC_SLP_WRITE); } catch (IntentSender.SendIntentException e) { // Fail silently } }
  75. 105.
  76. 106.

    private void deleteCredential(String email, String password) { final Credential credential

    = new Credential.Builder(email). setPassword(password). build(); Auth.CredentialsApi.delete(mCredentialsClient, credential); }
  77. 107.

    It would be so magical to get credentials already saved

    on my website. Doing so would streamline the sign-in experience.
  78. 108.

    It would be so magical to get credentials already saved

    on my website. Doing so would streamline the sign-in experience. Digital Assets Links to the rescue \o/
  79. 109.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ]
  80. 110.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] " ", "delegate_permission/common.get_login_creds" ], "target": { "namespace": "android_app", "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ]
  81. 111.

    [ { "relation": [ "delegate_permission/common.handle_all_urls" ], "target": { "namespace": "android_app",

    "package_name": "com.capitainetrain.android", "sha256_cert_fingerprints": [ “5A:BF:2C:43:1A:2E:54:A3:60:31:58:A7:62:AA:4D:E0:AA:BE: 50:F7:00:36:3C:CB:41:CD:83:FE:F5:B9:58:2C” ] } } ] , “delegate_permission/common.get_login_creds" "delegate_permission/common.get_login_creds"
  82. 112.
  83. 113.

    It would be so magical to get credentials already saved

    on my website. Doing so would streamline the sign-in experience.
  84. 114.

    Android app It would be so magical to get credentials

    already saved on my . Doing so would streamline the sign-in experience.
  85. 115.

    Android app It would be so magical to get credentials

    already saved on my . Doing so would streamline the sign-in experience. Digital Assets Links to the rescue \o/ … again
  86. 119.
  87. 120.
  88. 121.
  89. 130.
  90. 131.

    Don’t be afraid or lazy Tear down the walls between

    your web site and your native mobile apps.