Friday, October 18, 2013

Android and Bluetooth Low Energy

Talk by Dario Laverde, Senior Developer Evangelist for HTC

Bluetooth Low Energy began in 2001 was introduced with Nokia's Wibree and merged with the main standard in 2010 with Bluetooth 4.0.

The Bluetooth 4.0 core specifications include the classic Bluetooth technology, Bluetooth Low Energy and Bluetooth SMART. Hardware-wise Classic Bluetooth is limited to a 100 meter range with a transfer rate of one to three Mbit/s and uses under 30 mA while BLE utilizes a max range of 50 meters, has a 1 Mbit/s transfer rate and uses under 15 mA of power.

We have seen Bluetooth Low Energy used in health, fitness and proximity but there are many more possibilities. These uses have their own specifications known as BLE Profiles. These are for particular applications and manufacturers are expected to implement specs to ensure compatibility but are not required by the core specification itself.

Some profiles include:
HRP: Heart Rate Profile for pulse monitoring
HTP: Health Thermometer Profile for medical temperature measurement
GLP: Glucose Profile for blood glucose monitors
CSCP: Cycling Speed and Cadence Profile
RSP: Running Speed Profile
FMP: Find Me Profile
PXP: Proximity Profile that allows the device to detect if another device is near

BLE manufacturers are encouraged by Bluetooth SIG to create new profiles and extend others with proprietary characteristics to expand the original ones. This does create difficulty, however, with app developers having to contact the 3rd party manufacturers for specifications. BLE Profiles sit on top of the Generic Attribute Profile on the Host and shares the same radio with the classic Bluetooth but has many layers removed to make it more efficient.

BLE Protocols
General Attribute Profile (GATT)
Phone, the master/central role has the GATT Client, and the BLE Smart device, which is Slave/Peripheral and contains the Service and the Characteristic with the value and descriptors. There are some roles left out including the Broadcast Role. Android BLE only supports the central role but IOS supports both.

BLE GATT Clients and Servers
Servers expose the attributes while the clients use them. The Client Actions include discovering, reading, writing, confirming and indicating while the Server Actions include responding to the client actions, sending notifications and indicating.
To find more information, go to the Bluetooth SIG portal.

BLE Developer Device Kits
BLE chipset OEMs provide device kits which support different profiles. Texas Instruments' Sensorial has a bevy of sensors including acceleration, rotation, pressure, humidity, magnetic field and temperature.

Prior to Android 4.3, several OEMs already have devices on the market that support BLE and each provide their own BLE API including HTC, Samsung, Motorola and others. The BLE API was formally announced at Google IO 2013 and includes API Level 18. In most, if not all, cases, you will build on top of the GATT profile so your app must include the implementation of your required BLE profiles.

Demos
Scanning works slightly different than Classic Bluetooth in that it has its own callbacks.
It is more efficient in that by searching for Low Energy devices allows much faster scans compared to a scan for both classic and low energy Bluetooth devices. Sadly a known issue in Android is that, for the time being, it will only allow four sensor notifications.

Q & A
Resources/References
https://d.android.com/guide/topics/connectivity/bluetooth-le.html
http://processors.wiki.ti.com/index.php/Bluetooth_SensorTag
http://www.htcdev.com/devcenter/opensense-sdk/bluetooth-smart
Bluetooth SIG, Google IO 2013, TI.com/ble,
https://github.com/RadiusNetworks/android-ibeacon-service
contact info: dario.nycjava@gmail.com

Opening!


Greetings Google DevFest West 2013!

We'd like to start off by thanking Google for providing the facilities, room and the teeshirts and other prizes, GDG Silicon Valley and GDG San Francisco for putting on the event and Josh for doing the website.


To view the schedule as well as look at a couple of the talks go to http://www.devfestwest.com/2013 .
For those at the talks, lunch will be on the patio behind the building and there will be a break for lunch and dinner that will be catered. Talks will be held in building CL2 (Crane Beach Room) and CL3 (Maxwell Room).

Thanks for coming and have a great DevFest!

Setting up for DevFest West!

Badges and lanyards out, volunteers prepped, we are ready to go! We will have registration inside Building CL2's lobby (employee entrance). Open the floodgates!

Friday, September 13, 2013

Intro to App Engine and Cloud Computing

Wesley Chung is an engineer, writer, teacher, and was one of the original engineers who built Yahoo! mail. He stopped by our monthly GDG meetup to give everyone an introduction to Google App Engine and cloud platform.


Cloud Platform

Google got involved in cloud computing out of necessity. Google's search index last year exceeded 100 petabytes (100 million gigabytes). Roughly 4 days of video are uploaded to YouTube every minute. We don't know what percentage of that is cat videos.

The cloud technologies Google provides for you to use is an extension of the work they did tackling those internal problems. App Engine, Compute Engine, platform as a service. There are three pillars to their offerings: the compute side, storage, and application services. These combine to give you a platform to deploy your application without the usual worries of load balancing, availability, operating system, and all the little details that typically take up your time to bring your application to deployment worldwide.

Even better, the cloud platform provides APIs for networking functions that usually require extensive configuration, like email, database access, URL feeds, cloud storage, authentication, etc etc etc.

You get a full featured administrative console with too many features to list here. You'll have to explore it yourself. It's impressive.

App Engine

App Engine serves 7.5 billion page views every day. That's a "very googley" number.

Buddy Poke is a cutesy app that's been around almost as long as App Engine itself and is a good example of long term scaling, both in terms of registered users and daily use.

Gigya builds apps for special events, which is an example of short term scaling. Traffic spikes before and during the event, then dies off.

The royal wedding (Will & Kate) blog was hosted on App Engine. 32,000 users were hitting this app every second, peaking at 42kqps (kilo queries per second) when the royal couple kissed. You might call this "Royal Scaling."
This really tested App Engine's scalability

There are samples and tutorials available for web and mobile apps on App Engine, and a showcase of what other developers have built. There is a free tier if you want to try it (it only starts to cost money when you start to get significant traffic; by that point I hope you're making some money off your app), and don't worry about vendor lock-in. You can always move your application to another platform if you want.

Getting Started

You can play around with app engine on a web based SDK (no download required) at the Cloud Playground. Follow the link, clone one of the sample projects, and try it out.

Cloud Platform - Bringing it all Together

App Engine is the gateway to all other Google cloud services: databases (MySQL compatible and NoSQL), Google Translate, BigQuery, Google Prediction API, on demand virtual machines (RHEL/CentOS, Debian), local persistent storage, public cloud storage, there's even a REST API to create and manage VMs. Of course you can incorporate all the other Google APIs into your applications. Read more at the Cloud Platform Blog

That's all for this month. Thanks to everyone who attended and watched the talk on our YouTube channel. Happy hacking!

Friday, August 16, 2013

Build Native Apps with HTML5

Joe Marini came by to show us some neat tricks on the Chrome Packaged Apps Platform, building native apps in HTML5.



We had a huge turnout for this talk!

The public release will include native launch points for each OS (the Mac doc, Windows start menu, etc). Packaged apps run offline as well as online, they run locally and all the code (HTML5 and JS) is stored locally.

He showed some cool demos, including 500px, a code editor with syntax highlighting, and a magazine. The apps can use the native windows controls if you want, or you can build your own using webkit regions.

Packaged apps are an attempt to solve problems inherent in web applications, like intermittent connections. Most web apps have functions that should work offline, but they don't. With a packaged app you can retain offline functionality even if features requiring connectivity won't be available. Packaged apps also have access to platform capabilities and hardware (USB, bluetooth, sockets, etc). Imagine playing a web game with any controller you want. You can create a richer, more immersive experience, with distribution and updates managed through the chrome web store. Packaged apps also support in-app purchases with Google Wallet, as well as analytics.

Joe went into a deep dive into the packaged app structure. One interesting point is the differentiation between online and offline features, and developers need to think about what local resources are required to allow offline features to function in the absence of an Internet connection.

Want some specifics? No plugins! No Flash, no Java. You can embed native code using the HTML5 native client, but it can't use local storage because it is a synchronous API, and a synchronous API call can block the main thread causing your app to hang. You still get the functionality of local storage, as an asynchronous equivalent called Chrome Storage is supplied to be used instead. You can also leverage Chrome's cloud features, such as the Sync API and SyncFileSystem. It supports Google Drive out of the box, and is extensible for use with other services like DropBox.

Joe gave a lot of great pointers on how to build great packaged apps and some live code examples.

Like Dart? There is a chrome.dart github project, and as soon as Dart hits v1.0, they will start working on Dart for packaged apps.

Packaged apps are build with HTML5 and Chrome tools, but they live outside the browser, allowing for more developer options and a richer user experience. It was standing room only for this talk. Pretty cool stuff.

Joe is a developer advocate for the Chrome team, you can find him on twitter and github:
@joemarini
github.com/joemarini


Friday, June 29, 2012

Google I/O 2012 Recap

Another I/O has come and gone. While I was hoping to post constant updates, as usual the wifi was overwhelmed, keeping us in near radio silence. Now, as the conference winds down and the attendees head home, the few of us still here can sit in the comfy chair lounge and surf the web and write our blogs. Finally! Though I'm sad it's over.

Let me first say that skydiving wasn't the only exciting thing happening here, but watch the video anyway.


Now, the non-extreme-sport stuff.

The improvements to Android with Jelly Bean had everyone talking. Project Butter, improving responsiveness for a smoother interface is very noticeable. Attendees were given a Galaxy Nexus and Nexus 7 tablet, both with the new Jellybean OS so we could see for ourselves.

Incidentally, ZDNet featured a picture of GDG organizers Aygul and Misha posting with the new Android Jellybean statue. These two were married a year ago and spent part of their honeymoon at I/O 2011. Happy one year anniversary, guys!

Still more...

Google+ Invites! With Party Mode! It was a big hit at the after hours event, as you can see.

Like any new technology, however, there are a few initial kinks to work out, as Will Wheaton discovered. Don't worry, it's a great app and is going to vastly improve your social life :)

Google Compute Engine launched, with an amazing demo, showing a live genome analysis using 10,000 and 600,000 CPU cores. That's some computational power.

What else? Google Docs offline, Chrome for Android and iOS, offline maps for Android, a new Google Drive SDK, a new Maps API, and Google NowThese are just a few highlights. Everything is available onlineThe session on the future of GWT was very popular, with a long line to get in. There's no way to see it all as an attendee, so most of us will be watching sessions when we get back home.

Wednesday, December 7, 2011

Dart in December

The first Wednesday in December, our last meetup of the year. It was a packed house.

This month we got a look at Dart, a new web programming language, from two Google engineers. Seth Ladd is a web engineer, father, husband and is currently a Developer Advocate at Google.  He produced Aloha on Rails, the Hawaii Ruby on Rails and Web Development Conference and New Game, the conference for HTML5 game developers.  Way back, he wrote Expert Spring MVC book.  Seth was lucky enough to help release Angry Birds for the web.  He is current on the board for the Academy of Interactive Arts and SciencesSteve Messick works on the Dart Editor at Google.

Think of Dart as web programming with "batteries included." It's a new language, with new libraries, even its own VM, but it's based on a simple and familiar OOP model that takes almost no time to learn. It's in an early stage, open source technology preview so you can still provide feedback and affect the direction as it develops.

So why a new language? The web has some very good things going for it. Small to medium apps are easy to develop, it's platform independent with no installation required. It supports fast, incremental development, and it's everywhere, on every computer, every device. That's quite an impressive feat! What's so difficult? Writing large programs is hard. Very large program structure, libraries, the tools to see what's happening inside a running program is simply not possible. Consider two books: the very heavy volume "Javascript" and the thin, almost pamphlet-like "Javascript: The Good Parts." Any web developer can tell you, a lot of cruft has built up since the mid 90s.

Dart is a new approach to building structured web apps. It's not intended to compete with JavaScript, but to fill the vacuum evidenced by fragmented mobile platforms. Structured, high performance, high fidelity, feature-rich apps.

Dart is a simple, unsurprising OO language with typical classes, single inheritance, and interfaces -- everything you've seen before. The most unique feature is its optional typing. Developers can check types at compile time or runtime through an assertion-like method. It also has optional static typing, lexical scoping, and is single-threaded.

Wait, single threaded? Not to worry, it uses isolates similar to Erlang. Each isolate is conceptually a process and they can communicate through a mailbox system. With isolates, you can support concurrent execution with a single-threaded language. In the browser, UI elements are lightweight isolates and heavyweight isolates manifest themselves as HTML5 web workers.

There is a much-needed DOM overhaul loosely based on HTML5 DOM, but with lots of cleanup. Gone is the XML legacy. It supports type-checking and is built using Dart lists, which makes it terse.

Dart compiles to its own VM or to JavaScript. The tools can also take a snapshot of a running Dart program, serialize it, and transmit it to another VM. Obviously this could be used to cache programs for rapid startup. Receiving that heap snapshot and running it does require a Dart VM.

Seth Ladd and Steve Messick
The Dart editor is based an Eclipse RPC program. What you think about having code completion in a language bound to your web browser?  It is in technology preview mode and there's lots of work to do yet. The current focus is getting the performance up to par with the far more mature traditional web technologies, but they are looking for feedback as far as what to work on next. Should they have reflection support? Rest arguments? Enum? Pattern matching? What's the best way to integrate with other browsers? You can provide your feedback at the Dart web site and discussion groups.

The Dart Web site (www.dartlang.org) contains the language spec, tutorials, and prebuilt binaries.

The Dart Project site (dart.googlecode.com) is where you can get source code, libraries, and sample apps.

You can watch the talk here

Update: Seth Ladd has provided the slides at http://www.dartlang.org/slides/2011/12/gtug/ and written a quick tour of the SDK on his blog at http://blog.sethladd.com/2012/01/dart-sdk-quick-tour.html