Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Jeff Prestes
Physical Web
Giving a URL to everything, including you.
About me…
@jeffprestes
linkedin/in/jeffprestes
github.com/jeffprestes
slideshare.net/jeffprestes
CEO Novatrix
Java, PHP, G...
Jeff Prestes
Physical Web
Giving a URL to everything, including you.
What is it?
@jeffprestes#physicalwebbr
http://physical-web.org
@jeffprestes#physicalwebbr
URL for everything
Easily accessible
@jeffprestes#physicalwebbr
Beacon
@jeffprestes#physicalwebbr
@jeffprestes#physicalwebbr
Confidential and Proprietary9
What is a Beacon ?
Movies are worth a 1000 slides, so…
https://www.youtube.com/watch?v=JrRS8...
Eddystone
Protocol
@jeffprestes#physicalwebbr
eddystone-tlm
eddystone-uid
eddystone-url
@jeffprestes#physicalwebbr
eddystone-tlm
eddystone-uid
eddystone-url
@jeffprestes#physicalwebbr
eddystone-tlm
eddystone-uid
eddystone-url
@jeffprestes#physicalwebbr
eddystone-tlm
eddystone-uid
eddystone-url
@jeffprestes#physicalwebbr
eddystone-url
@jeffprestes#physicalwebbr
https://github.com/google/eddystone/tree/master/eddystone-url
@jeffprestes#physicalwebbr
Set the URL to a
URL shortner
@jeffprestes#physicalwebbr
Chrome allows until
5 redirections
@jeffprestes#physicalwebbr
Important
@jeffprestes#physicalwebbr
There’re Chrome’s
requirements
to show
URLs
@jeffprestes#physicalwebbr
HTTPS
@jeffprestes#physicalwebbr
Cannot have
robot.txt or any other
measure to avoid the
page to be crawled
@jeffprestes#physicalwebbr
The URL can’t
be on Google’s
Phising or Spam
list
@jeffprestes#physicalwebbr
99% of pages not
shown is due to
does not satisfy
those criteria
@jeffprestes#physicalwebbr
Demo
@jeffprestes#physicalwebbr
@jeffprestes#physicalwebbr
Configuring
Google Chrome
@jeffprestes#physicalwebbr
https://support.google.com/chrome/answer/6239299
LinkedIn
@jeffprestes#physicalwebbr
Demo
@jeffprestes#physicalwebbr
Advertising
my URL
https://github.com/jeffprestes/node-eddystone-url
@jeffprestes#physicalwebbr
var Beacon = require('./node_modules/eddystone-beacon/lib/beacon');
beacon = new Beacon();
var options = {
txPowerLevel: -...
Code Source
example to detect URL
Physical Web App
https://play.google.com/store/apps/details?id=physical_web.org.physical...
MainActivity.java
protected void onResume() {
super.onResume();
BluetoothManager btManager = (BluetoothManager) getSystemS...
NearbyBeaconsFragment.java
public void onResume() {
super.onResume();
getActivity().getActionBar().setTitle(R.string.title...
PwoDiscoveryService.java
/**
* This is a service that scans for nearby Physical Web Objects.
* It is created by MainActivi...
BlePwoDiscoverer.java
public class BlePwoDiscoverer extends PwoDiscoverer
implements BluetoothAdapter.LeScanCallback {
mBl...
mScanFilterUuids = new ParcelUuid[]{URIBEACON_SERVICE_UUID, EDDYSTONE_URL_SERVICE_UUID};
@Override
public void onLeScan(fi...
/**
* Parse scan record bytes to Eddystone
* The format is defined in Eddystone specification.
*
* @param scanRecordBytes ...
private static String decodeUri(byte[] serviceData, int offset) {
if (serviceData.length == offset) {
return NO_URI;
}
Str...
private static String decodeUri(byte[] serviceData, int offset) {
if (serviceData.length == offset) {
return NO_URI;
}
Str...
/**
* URI Scheme maps a byte code into the scheme and an optional scheme specific prefix.
*/
private static final SparseAr...
Use cases
examples
@jeffprestes#physicalwebbr
Transportation
use cases for
Visual Impaired Persons
@jeffprestes#physicalwebbr
Commerce
use cases for
Visual Impaired Persons
@jeffprestes#physicalwebbr
Museums
use cases
@jeffprestes#physicalwebbr
Physical Web
http://physical-web.org
@jeffprestes#physicalwebbr
I’d love to hear
your questions.
Thanks.
Jeff Prestes
@jeffprestes
linkedin.com/in/jeffprestes
Slideshare.com/jeffprestes
...
Upcoming SlideShare
Loading in …5
×

Physical web

862 views

Published on

Physical Web is an important component for the Smart Cities and for monetizing IoT projects. This talk explain what is it and how to implement it using Eddystone protocol.

Published in: Mobile
  • Be the first to comment

Physical web

  1. 1. Jeff Prestes Physical Web Giving a URL to everything, including you.
  2. 2. About me… @jeffprestes linkedin/in/jeffprestes github.com/jeffprestes slideshare.net/jeffprestes CEO Novatrix Java, PHP, Go, JavaScript, Mobile Developer and IoT Researcher www.novatrix.com.br
  3. 3. Jeff Prestes Physical Web Giving a URL to everything, including you.
  4. 4. What is it? @jeffprestes#physicalwebbr
  5. 5. http://physical-web.org @jeffprestes#physicalwebbr
  6. 6. URL for everything Easily accessible @jeffprestes#physicalwebbr
  7. 7. Beacon @jeffprestes#physicalwebbr
  8. 8. @jeffprestes#physicalwebbr
  9. 9. Confidential and Proprietary9 What is a Beacon ? Movies are worth a 1000 slides, so… https://www.youtube.com/watch?v=JrRS8qRYXCQ https://www.youtube.com/watch?v=3QFrZjvp2E0 https://www.youtube.com/watch?v=mc3KmbfxuUQ @jeffprestes#physicalwebbr
  10. 10. Eddystone Protocol @jeffprestes#physicalwebbr
  11. 11. eddystone-tlm eddystone-uid eddystone-url @jeffprestes#physicalwebbr
  12. 12. eddystone-tlm eddystone-uid eddystone-url @jeffprestes#physicalwebbr
  13. 13. eddystone-tlm eddystone-uid eddystone-url @jeffprestes#physicalwebbr
  14. 14. eddystone-tlm eddystone-uid eddystone-url @jeffprestes#physicalwebbr
  15. 15. eddystone-url @jeffprestes#physicalwebbr
  16. 16. https://github.com/google/eddystone/tree/master/eddystone-url @jeffprestes#physicalwebbr
  17. 17. Set the URL to a URL shortner @jeffprestes#physicalwebbr
  18. 18. Chrome allows until 5 redirections @jeffprestes#physicalwebbr
  19. 19. Important @jeffprestes#physicalwebbr
  20. 20. There’re Chrome’s requirements to show URLs @jeffprestes#physicalwebbr
  21. 21. HTTPS @jeffprestes#physicalwebbr
  22. 22. Cannot have robot.txt or any other measure to avoid the page to be crawled @jeffprestes#physicalwebbr
  23. 23. The URL can’t be on Google’s Phising or Spam list @jeffprestes#physicalwebbr
  24. 24. 99% of pages not shown is due to does not satisfy those criteria @jeffprestes#physicalwebbr
  25. 25. Demo @jeffprestes#physicalwebbr
  26. 26. @jeffprestes#physicalwebbr
  27. 27. Configuring Google Chrome @jeffprestes#physicalwebbr https://support.google.com/chrome/answer/6239299
  28. 28. LinkedIn @jeffprestes#physicalwebbr
  29. 29. Demo @jeffprestes#physicalwebbr
  30. 30. Advertising my URL https://github.com/jeffprestes/node-eddystone-url @jeffprestes#physicalwebbr
  31. 31. var Beacon = require('./node_modules/eddystone-beacon/lib/beacon'); beacon = new Beacon(); var options = { txPowerLevel: -22, //override TX Power Level, default value is -21 tlmCount: 2, // 2 TLM frames tlmPeriod: 10 // every 10 advertisements }; beacon.advertiseUrl('http://www.maquinataxi.com', [options]); @jeffprestes#physicalwebbr
  32. 32. Code Source example to detect URL Physical Web App https://play.google.com/store/apps/details?id=physical_web.org.physicalweb https://itunes.apple.com/us/app/physical-web/id927653608?mt=8 @jeffprestes#physicalwebbr
  33. 33. MainActivity.java protected void onResume() { super.onResume(); BluetoothManager btManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE); BluetoothAdapter btAdapter = btManager != null ? btManager.getAdapter() : null; if (btAdapter == null) { finish(); return; } if (checkIfUserHasOptedIn()) { ensureBluetoothIsEnabled(btAdapter); showNearbyBeaconsFragment(); } else { // Show the oob activity // Webview to: https://google.github.io/physical-web/mobile/android/getting-started.html Intent intent = new Intent(this, OobActivity.class); startActivity(intent); } } @jeffprestes#physicalwebbr
  34. 34. NearbyBeaconsFragment.java public void onResume() { super.onResume(); getActivity().getActionBar().setTitle(R.string.title_nearby_beacons); getActivity().getActionBar().setDisplayHomeAsUpEnabled(false); getListView().setVisibility(View.INVISIBLE); mDiscoveryServiceConnection.connect(true); } public synchronized void connect(boolean requestCachedPwos) { if (mDiscoveryService != null) { return; } mRequestCachedPwos = requestCachedPwos; Intent intent = new Intent(getActivity(), PwoDiscoveryService.class); getActivity().startService(intent); getActivity().bindService(intent, this, Context.BIND_AUTO_CREATE); } @jeffprestes#physicalwebbr
  35. 35. PwoDiscoveryService.java /** * This is a service that scans for nearby Physical Web Objects. * It is created by MainActivity. * It finds nearby ble beacons, and stores a count of them. * It also listens for screen on/off events * and start/stops the scanning accordingly. * It also silently issues a notification informing the user of nearby beacons. * As beacons are found and lost, the notification is updated to reflect * the current number of nearby beacons. */ public class PwoDiscoveryService extends Service private void initialize() { mNotificationManager = NotificationManagerCompat.from(this); mPwoDiscoverers = new ArrayList<>(); mPwoDiscoverers.add(new BlePwoDiscoverer(this)); for (PwoDiscoverer pwoDiscoverer : mPwoDiscoverers) { pwoDiscoverer.setCallback(this); } ... } @jeffprestes#physicalwebbr
  36. 36. BlePwoDiscoverer.java public class BlePwoDiscoverer extends PwoDiscoverer implements BluetoothAdapter.LeScanCallback { mBluetoothAdapter.startLeScan(this); @jeffprestes#physicalwebbr
  37. 37. mScanFilterUuids = new ParcelUuid[]{URIBEACON_SERVICE_UUID, EDDYSTONE_URL_SERVICE_UUID}; @Override public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanBytes) { if (!leScanMatches(ScanRecord.parseFromBytes(scanBytes))) { return; } UriBeacon uriBeacon = UriBeacon.parseFromBytes(scanBytes); if (uriBeacon == null) { return; } String url = uriBeacon.getUriString(); if (!URLUtil.isNetworkUrl(url)) { return; } PwoMetadata pwoMetadata = createPwoMetadata(url); pwoMetadata.setBleMetadata(device.getAddress(), rssi, uriBeacon.getTxPowerLevel()); pwoMetadata.bleMetadata.updateRegionInfo(); reportPwo(pwoMetadata); } BlePwoDiscoverer.java @jeffprestes#physicalwebbr
  38. 38. /** * Parse scan record bytes to Eddystone * The format is defined in Eddystone specification. * * @param scanRecordBytes The scan record of Bluetooth LE advertisement and/or scan response. */ public static UriBeacon parseFromBytes(byte[] scanRecordBytes) { byte[] serviceData = parseServiceDataFromBytes(scanRecordBytes); ... if (serviceData != null && serviceData.length >= 2) { int currentPos = 0; byte txPowerLevel = serviceData[currentPos++]; byte flags = (byte) (serviceData[currentPos] >> 4); serviceData[currentPos] = (byte) (serviceData[currentPos] & 0xFF); String uri = decodeUri(serviceData, currentPos); return new UriBeacon(flags, txPowerLevel, uri); } return null; } UriBeacon.java @jeffprestes#physicalwebbr
  39. 39. private static String decodeUri(byte[] serviceData, int offset) { if (serviceData.length == offset) { return NO_URI; } StringBuilder uriBuilder = new StringBuilder(); if (offset < serviceData.length) { byte b = serviceData[offset++]; String scheme = URI_SCHEMES.get(b); if (scheme != null) { uriBuilder.append(scheme); if (URLUtil.isNetworkUrl(scheme)) { return decodeUrl(serviceData, offset, uriBuilder); } else if ("urn:uuid:".equals(scheme)) { return decodeUrnUuid(serviceData, offset, uriBuilder); } } Log.w(TAG, "decodeUri unknown Uri scheme code=" + b); } return null; } UriBeacon.java @jeffprestes#physicalwebbr
  40. 40. private static String decodeUri(byte[] serviceData, int offset) { if (serviceData.length == offset) { return NO_URI; } StringBuilder uriBuilder = new StringBuilder(); if (offset < serviceData.length) { byte b = serviceData[offset++]; String scheme = URI_SCHEMES.get(b); if (scheme != null) { uriBuilder.append(scheme); if (URLUtil.isNetworkUrl(scheme)) { return decodeUrl(serviceData, offset, uriBuilder); } else if ("urn:uuid:".equals(scheme)) { return decodeUrnUuid(serviceData, offset, uriBuilder); } } Log.w(TAG, "decodeUri unknown Uri scheme code=" + b); } return null; } UriBeacon.java @jeffprestes#physicalwebbr
  41. 41. /** * URI Scheme maps a byte code into the scheme and an optional scheme specific prefix. */ private static final SparseArray<String> URI_SCHEMES = new SparseArray<String>() {{ put((byte) 0, "http://www."); put((byte) 1, "https://www."); put((byte) 2, "http://"); put((byte) 3, "https://"); put((byte) 4, "urn:uuid:"); // RFC 2141 and RFC 4122}; }}; /** * Expansion strings for "http" and "https" schemes. These contain strings appearing anywhere in a * URL. Restricted to Generic TLDs. <p/> Note: this is a scheme specific encoding. */ private static final SparseArray<String> URL_CODES = new SparseArray<String>() {{ put((byte) 0, ".com/"); put((byte) 1, ".org/"); put((byte) 2, ".edu/"); put((byte) 3, ".net/"); put((byte) 4, ".info/"); put((byte) 5, ".biz/"); put((byte) 6, ".gov/"); put((byte) 7, ".com"); put((byte) 8, ".org"); put((byte) 9, ".edu"); put((byte) 10, ".net"); put((byte) 11, ".info"); put((byte) 12, ".biz"); put((byte) 13, ".gov"); }}; UriBeacon.java @jeffprestes#physicalwebbr
  42. 42. Use cases examples @jeffprestes#physicalwebbr
  43. 43. Transportation use cases for Visual Impaired Persons @jeffprestes#physicalwebbr
  44. 44. Commerce use cases for Visual Impaired Persons @jeffprestes#physicalwebbr
  45. 45. Museums use cases @jeffprestes#physicalwebbr
  46. 46. Physical Web http://physical-web.org @jeffprestes#physicalwebbr
  47. 47. I’d love to hear your questions. Thanks. Jeff Prestes @jeffprestes linkedin.com/in/jeffprestes Slideshare.com/jeffprestes Github.com/jeffprestes www.novatrix.com.br

×