Transitioning from android to glass


Luis de la Rosa

Lead Application Developer

intro


My qualifications

What you need to know

What you will learn

web -> phone

Bring over whole thing

Create subset of UI

Surface functionality via APIs (web services)

Design for smaller screen

Phone -> tablet


Scale it up

Utilize additional space better

phone -> glass


???

Profit

android




Glass


android vs glass: fight!


Display

Battery

Touch

POV

4.4 vs Sneak Peek

Hello android world


Activity

TextView

Gdk setup

hello glass world


Immersion

Voice Trigger

Theme

Glass Library

GDK vs android sdk


6 new packages

19 new classes

No emulator

Activities + Services play special roles

synergy

“The API surface of GDK Glassware is not limited to the classes contained in the GDK Add-on. The GDK Add-on merely closes the gaps between the Android SDK and features that are unique to Glass. This means, in general, given a problem that isn't covered by the GDK library directly, just attempt the Android solution.”
- Jenny Murphy
Staff Developer Programs Engineer on Google Glass
on Stack Overflow

glanceable ui


Fundamentally different from phone and tablet UI

Less content

Quicker

Bigger

Now

timeline









Immersions exist outside

home card


Voice Launcher

Tap Launcher

Contrast with Home Screen

cards


Like Google Now

Horizontal rather than vertical

Main UI metaphor for Glass

use the templates

static cards


They do not update after creation

Very limited in GDK

Use Mirror API

any questions so far?

live cards


Constantly updated to stay fresh

Difference in update intervals: low vs high frequency

low-frequency live cards


> Few seconds between updates

Use RemoteViews

Must call setViews to update

high-frequency live cards


Near real-time updating

Surface

Callbacks

project: stackoverflow profile


Useful to see inbox and also track score

Stack Overflow rep changes relatively infrequently

Lots of data

android version


Lot of room

Can show most of the data

Many tap targets
 


glass version


Simplified

Glanceable

Low frequency Live Card

Menu for actions

services + live cards


Integral
Handles lifecycle

menus in live cards


PendingIntent as Action

Activity hosts menu items

Gotchas:
- Register the Activity in AndroidManifest.xml
- onAttachedToWindow
- Transparency via style
- Must have at least Stop menu item

live card lifecycle


Service starts via Voice Trigger
onStartCommand() {    liveCardInstance = Timeline.createLiveCard(LIVE_CARD_TAG);    liveCardInstance.setAction(menuActivityPendingIntent);    // set up UI for LiveCard and then...
    liveCardInstance.publish(SILENT or REVEAL);    return START_STICKY;}

Service stops via stopService from menu item
onDestroy() {    liveCardInstance.unpublish();}

alternative android version

home screen widget

RemoteViews

App Widgets

Cousin to Live Card

touring the gdk examples


Compass

Stopwatch

Timer

Hint: File > New > Android Sample Project


immersions


Repurposed Activity

Full control over Glass hardware

Exist outside of Timeline

Be careful of Glassing-out

project: reddit viewer


List the posts in a subreddit

Common list-based app UI

android version


Activity

Vertical scrolling

Row-based

ListView


glass version


Immersion

Horizontal scrolling / paging

Card-based

CardScrollAdapter

CardScrollView

alternate android version


Horizontal scrolling / paging

Fragment-based

ViewPager

menus in immersions


Show when tapped

openOptionsMenu()  

Ordinary Android menu methods

onCreateOptionsMenu()
onOptionsItemSelected()
onOptionsMenuClosed() 

touch


Default: D-Pad events

Timeline consumes some for non-Immersions

Swipe down is like Back button

Two finger swipe down is sleep


more touch


GestureDetector

Swipe up/down/left/right + TwoSwipe
Tap / TwoTap / ThreeTap
LongPress / TwoLongPress / ThreeLongPress

Finger count change

Scroll listener
Two finger scroll listener

voice control


Voice Trigger

Voice Prompt

Speech Recognizer

No contextual voice commands yet (Issue 273)

head movement

Unique way to get user input

Not eye tracking

Accelerometer

Unknown ergonomic impact

Built-in Glass gestures

getWindow().addFlags(WindowUtils.FLAG_DISABLE_HEAD_GESTURES); 

location


No Google Play Services yet

Old school Location

Iterate over all providers, including remote (tethered)

sensors


Accelerometer

Gyroscope

Magnetometer

Relative to "optics pod" aka prism

Light

camera


Capture image:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, MY_REQUEST_ID); 
Capture video:
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, MY_REQUEST_ID); 
Can capture hardware button in Immersion
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_CAMERA) {

battery


Video

Sensors

navigation

Driving
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,   Uri.parse("google.navigation:q=your+address"));
startActivity(intent); 
Walking
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,  Uri.parse("google.navigation:q=your+address&mode=w"));
startActivity(intent); 

login flow


QR code

AccountManager

Star Issue #276

In-Progress

open source libraries


glass-progress-bar

GlassSettings

glass-head-gesture-detector

next steps

https://developers.google.com/glass/community

Tag [google-gdk] on Stack Overflow

File Bugs / Feature requests

Join local Glass meetups

Please give feedback via the app at
eventmobi.com/wearablesdevcon








Presentation is at
luisdelarosa.com
Made with Slides.com