Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nearby Notifications – annoy your friends!

Nearby Notifications – annoy your friends!

Radek Piekarz

December 08, 2016
Tweet

More Decks by Radek Piekarz

Other Decks in Programming

Transcript

  1. Agenda History iBeacon Eddystone Using Beacons before 2016 Using Beacons

    now Nearby notifications Physical Web @lukaszbyjos
  2. 2011 2012 2013 Apple launches iBeacon technology Android 4.3 supports

    Bluetooth 4.0 2014 2015 2016 iPhone 4S First smartphone with Bluetooth 4.0 Google launches Eddystone specifications Physical Web support on Google Chrome v. 49 for Android Nearby Notifications
  3. iBeacon • iBeacon protocol supports both iOS and Android •

    Beacon manufacturer need to be vetted by Apple to be iBeacon compliance • iBeacon transmits simple data fields like UUID, Major ID, and Minor ID.
  4. Eddystone • Eddystone supported beacons can emit three different frame

    type signals • All three frame types are supported by both Android and iOS • Open standard / open source (github.com/google/eddystone)
  5. Eddystone-UID • Similar to iBeacon, the beacon which supports Eddystone

    UID needs an app to receive designated UID for the app to recognize • Eddystone’s UID have 16 digit strings to identify a beacon uniquely, 10 character Namespace to identify an entity / organization and a 6 character Instance to identify individual beacons • Eddystone-EID
  6. Eddystone-URL • Eddystone URL supported beacons does not require an

    app to catch the data transmitted from it but it requires a beacon supported browser installed. • Eddystone URL broadcasts a URL, which can link to any site. • This is basically for the “Physical Web”, where developer can put content which everyone can access it. (http://google.github.io/physical- web/)
  7. Eddystone-TLM • These beacons send Eddystone UID, Eddystone URL and

    beacons health status like battery life, diagnostic data etc. • These are mainly intended for beacons fleet management and they transmits data less frequently compared to other two.
  8. Scanning for beacons BluetoothAdapter BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback(){ @Override

    public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord){ } }; device - Identifies the remote device rssi - The RSSI value for the remote device as reported by the Bluetooth hardware. scanRecord - The content of the advertisement record offered by the remote device.
  9. Scanning for beacons BluetoothAdapter BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback(){ @Override

    public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord){ } }; device - Identifies the remote device rssi - The RSSI value for the remote device as reported by the Bluetooth hardware. scanRecord - The content of the advertisement record offered by the remote device.
  10. Battery? = My Super App Shopping App Public Transport App

    Beacon scanning background service Beacon scanning background service Beacon scanning background service
  11. Battery? = Beacon Scanning Service My Super App Shopping App

    Public Transport App BroadcastReceiver BroadcastReceiver BroadcastReceiver Google Play Services
  12. Nearby API private PendingIntent getPendingIntent() { Intent intent = new

    Intent(context, BeaconMessageReceiver.class); return PendingIntent.getBroadcast(context, REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT); }
  13. Nearby API public class BeaconMessageReceiver extends BroadcastReceiver { @Override public

    void onReceive(Context context, Intent intent) { Nearby.Messages.handleIntent(intent, new MessageListener() { @Override public void onFound(Message message) { } @Override public void onLost(Message message){ } }); }
  14. Nearby API • We don’t have to deal with bluetooth

    runtime permissions • But we need to ask user to allow Nearby
  15. Nearby notifications • Get a beacon (or make one!) •

    Register it in Google Beacon Dashboard
  16. Nearby notifications • Get a beacon (or make one!) •

    Register it in Google Beacon Dashboard • Configure notifications
  17. Takeaways #1 • Only https:// addresses are supported • Scan

    is performed only when screen is turning on • App intents are currently available only for Google Partners
  18. Takeaways #1 • Only https:// addresses are supported • Scan

    is performed only when screen is turning on • App intents are currently available only for Google Partners • App intent are available for anyone!
  19. Physical Web • Open standard that everyone can use •

    No proactive notifications • Open Source • BLE energy efficient & widespread • Built on web and urls • Can use mDNS too • Context is the king • Connect digital and real world • Use Eddystone URL beacons • Supported by Chrome for Android, Opera for Android
  20. Takeaways #2 • With great power comes great resposibility •

    Nearby API is easy and energy efficient • Nearby Notifications are the most easy way to start using Beacons on Android