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

PRESTO Lookup: The Untold Story

PRESTO Lookup: The Untold Story

PRESTO is a contactless farecard for use on public transit systems in Ottawa and the Greater Toronto Area. I played around with the NFC APIs in Android to develop an app that could "talk" to a PRESTO card. This is the story of how it went down.

Originally presented at Toronto Android Developers Meetup (http://www.meetup.com/ToAndroidDev/events/232238799/).

For the original slides, with clickable links, please go to Google Slides: https://docs.google.com/presentation/d/1VZ9gwmumXySAuXuDTGaYhJkArcsGz5UrmxZTNL2jyjY/edit?usp=sharing

Eric Fung

July 11, 2016
Tweet

More Decks by Eric Fung

Other Decks in Programming

Transcript

  1. Card in wallet = Mobile app = Photo by Paula

    Lavalle: https://unsplash.com/photos/StI47JBhSNc
  2. First Steps • Get Card(s) • Ride the train Photo:

    http://www.metrolinx.com/en/projectsandprograms/presto/zcard.jpg
  3. Tap ⟶ Login ⟶ Scrape ⟶ Display Outline Photo by

    Viktor Hanacek: https://picjumbo.com/webdesign-layout-sketching/
  4. Tap ⟶ Login ⟶ Scrape ⟶ Display • Determine protocol

    • Guess type of card • Request version, parse unique ID
  5. “ PRESTO is actively investigating… systems such as… mobile device

    applications. Photo by Vodafone: https://www.flickr.com/photos/vodafone_de/19579727715
  6. Tap ⟶ Login ⟶ Scrape ⟶ Display • Recall: can’t

    get balance from card • Need to authenticate with website…
  7. “ jsoup is a Java library for working with real-world

    HTML. It provides a very convenient API for extracting and manipulating data. Photo: https://pixabay.com/en/lifesaver-life-buoy-safety-rescue-933560/
  8. private static final String INPUT_REGISTERED_USERNAME = "ctl00_SPWebPartManager1_AccountLoginWebpartControl_ctl00_webpartRegistere dUserLogin_ctl00_textboxRegisteredLogin"; FormElement usernameEle

    = form.get(INPUT_REGISTERED_USERNAME); FormElement passwordEle = form.get(INPUT_REGISTERED_PASSWORD); usernameEle.set(mCard.username); passwordEle.set(mCard.password); button = form.getSubmitButton(byId(BUTTON_REGISTERED_SUBMIT)); HtmlDocument response = (HtmlDocument)form.submit(button); Tap ⟶ Login ⟶ Scrape ⟶ Display
  9. Tap ⟶ Login ⟶ Scrape ⟶ Display • Screen scraping

    forces you to deal with implementation and presentation • An API declares an interface and models Photo by Joshua Willson: https://pixabay.com/en/ford-mustang-engine-hood-bonnet-1242192/
  10. Tap ⟶ Login ⟶ Scrape ⟶ Display • How fragile?

    ◦ Ottawa consolidated with GTA ◦ Username/Password replaced PIN ◦ FR currency formatting
  11. Play Store • After 3 years, average rating of 3.7

    • 215 reviews • 8000 MAU Photo by Pattern Pictures: http://www.patternpictures.com/four-silver-stars-wall/
  12. The Good • “When will we be able to ditch

    the Presto card and just use our NFC phones instead?” • “The app makes it easier to check your card balance and history. Faster than using a browser…” • “Just a tiny glimpse of what presto should be… This app brings Presto into the 21ST century. Too bad it's not official.” Photo: https://pixabay.com/en/thumbs-up-hand-people-926080/
  13. The Bad • “PLEASE FIX THESE PROBLEMS, I know the

    24 hour delay part is hard to fix…” • “Tap card on back of device... ... And then enter card number?!! So what's the point of tapping, then?” • “One trick pony Lets you check your Presto card balance. Nothing else …”
  14. • Not much incentive to update the app • Android

    Pay demoed at I/O for London Underground • We can only hope The Future Photo by Forrest Cavale: https://unsplash.com/photos/29SqSdfvN_A