physical web
TRANSCRIPT
![Page 1: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/1.jpg)
Jeff Prestes
Physical WebGiving a URL to everything, including you.
![Page 2: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/2.jpg)
About me…
@jeffpresteslinkedin/in/jeffprestesgithub.com/jeffprestesslideshare.net/jeffprestes
CEO NovatrixJava, PHP, Go, JavaScript, Mobile Developer and IoT Researcher
www.novatrix.com.br
![Page 3: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/3.jpg)
Jeff Prestes
Physical WebGiving a URL to everything, including you.
![Page 4: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/4.jpg)
What is it?
@jeffprestes#physicalwebbr
![Page 5: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/5.jpg)
http://physical-web.org
@jeffprestes#physicalwebbr
![Page 6: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/6.jpg)
URL for everythingEasily accessible
@jeffprestes#physicalwebbr
![Page 7: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/7.jpg)
Beacon
@jeffprestes#physicalwebbr
![Page 8: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/8.jpg)
@jeffprestes#physicalwebbr
![Page 9: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/9.jpg)
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
![Page 10: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/10.jpg)
EddystoneProtocol
@jeffprestes#physicalwebbr
![Page 11: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/11.jpg)
eddystone-tlmeddystone-uideddystone-url
@jeffprestes#physicalwebbr
![Page 12: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/12.jpg)
eddystone-tlmeddystone-uideddystone-url
@jeffprestes#physicalwebbr
![Page 13: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/13.jpg)
eddystone-tlmeddystone-uideddystone-url
@jeffprestes#physicalwebbr
![Page 14: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/14.jpg)
eddystone-tlmeddystone-uideddystone-url
@jeffprestes#physicalwebbr
![Page 15: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/15.jpg)
eddystone-url
@jeffprestes#physicalwebbr
![Page 16: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/16.jpg)
https://github.com/google/eddystone/tree/master/eddystone-url
@jeffprestes#physicalwebbr
![Page 17: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/17.jpg)
Set the URL to a URL shortner
@jeffprestes#physicalwebbr
![Page 18: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/18.jpg)
Chrome allows until 5
redirections
@jeffprestes#physicalwebbr
![Page 19: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/19.jpg)
Important
@jeffprestes#physicalwebbr
![Page 20: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/20.jpg)
There’re Chrome’srequirements
to showURLs
@jeffprestes#physicalwebbr
![Page 21: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/21.jpg)
HTTPS
@jeffprestes#physicalwebbr
![Page 22: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/22.jpg)
Cannot have robot.txt or any
other measure to avoid the page to
be crawled
@jeffprestes#physicalwebbr
![Page 23: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/23.jpg)
The URL can’t be on
Google’s Phising or Spam list
@jeffprestes#physicalwebbr
![Page 24: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/24.jpg)
99% of pages not shown is
due to does not satisfy those
criteria @jeffprestes#physicalwebbr
![Page 25: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/25.jpg)
Demo
@jeffprestes#physicalwebbr
![Page 26: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/26.jpg)
@jeffprestes#physicalwebbr
![Page 27: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/27.jpg)
ConfiguringGoogle Chrome
@jeffprestes#physicalwebbr
https://support.google.com/chrome/answer/6239299
![Page 28: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/28.jpg)
@jeffprestes#physicalwebbr
![Page 29: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/29.jpg)
Demo
@jeffprestes#physicalwebbr
![Page 30: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/30.jpg)
Advertising my URL
https://github.com/jeffprestes/node-eddystone-url
@jeffprestes#physicalwebbr
![Page 31: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/31.jpg)
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
![Page 32: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/32.jpg)
Code Source example to detect URL
Physical Web Apphttps://play.google.com/store/apps/details?id=physical_web.org.physicalweb
https://itunes.apple.com/us/app/physical-web/id927653608?mt=8
@jeffprestes#physicalwebbr
![Page 33: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/33.jpg)
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
![Page 34: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/34.jpg)
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
![Page 35: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/35.jpg)
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 Serviceprivate void initialize() { mNotificationManager = NotificationManagerCompat.from(this); mPwoDiscoverers = new ArrayList<>(); mPwoDiscoverers.add(new BlePwoDiscoverer(this)); for (PwoDiscoverer pwoDiscoverer : mPwoDiscoverers) { pwoDiscoverer.setCallback(this); } ...}
@jeffprestes#physicalwebbr
![Page 36: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/36.jpg)
BlePwoDiscoverer.java
public class BlePwoDiscoverer extends PwoDiscoverer implements BluetoothAdapter.LeScanCallback {
mBluetoothAdapter.startLeScan(this);
@jeffprestes#physicalwebbr
![Page 37: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/37.jpg)
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
![Page 38: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/38.jpg)
/** * 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
![Page 39: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/39.jpg)
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
![Page 40: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/40.jpg)
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
![Page 41: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/41.jpg)
/** * 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
![Page 42: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/42.jpg)
Use cases examples
@jeffprestes#physicalwebbr
![Page 43: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/43.jpg)
Transportationuse cases for
Visual Impaired Persons
@jeffprestes#physicalwebbr
![Page 44: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/44.jpg)
Commerceuse cases for
Visual Impaired Persons
@jeffprestes#physicalwebbr
![Page 45: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/45.jpg)
Museums use cases
@jeffprestes#physicalwebbr
![Page 46: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/46.jpg)
Physical Webhttp://physical-web.org
@jeffprestes#physicalwebbr
![Page 47: Physical web](https://reader035.vdocument.in/reader035/viewer/2022070601/58870bf21a28abf2228b51d5/html5/thumbnails/47.jpg)
I’d love to hearyour questions.
Thanks.
Jeff Prestes
@jeffpresteslinkedin.com/in/jeffprestesSlideshare.com/jeffprestesGithub.com/jeffprestes
www.novatrix.com.br