ok glass... make me a sandwich (with code samples)
TRANSCRIPT
![Page 2: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/2.jpg)
Glassware, ¿qué aporta?Inmediatez
Relevancia
Contexto
![Page 3: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/3.jpg)
Fácil y rápido
![Page 4: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/4.jpg)
Sólo información relevante
![Page 5: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/5.jpg)
No te metas en medio
![Page 6: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/6.jpg)
¿Cómo puedes hacer esto?
Android+
Glass Development Kit
![Page 7: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/7.jpg)
Glass Development Kit
![Page 8: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/8.jpg)
Instalar GDK
![Page 9: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/9.jpg)
Componentes GDK1. Timeline
2. Live Card
3. Static Card
4. Immersion
5. Menús(*)
6. CardScroll: Adapter + View
7. Voice Trigger
![Page 10: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/10.jpg)
GDK: TimelinePresente y futuro
Pasado
![Page 11: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/11.jpg)
GDK: Static Card// Create with current context
Card mCard = new Card(mContext);
mCard.setText("Esto es una static card");
mCard.setFootnote("Y esto es su footer!");
// Add card to timeline
TimelineManager.from(mContext).insert(mCard);
![Page 12: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/12.jpg)
GDK: Live Card
![Page 13: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/13.jpg)
GDK: Live Card// Create livecard using TimelineManager
mLiveCard = TimelineManager.from(mContext).createLiveCard(LIVE_CARD_SAMPLE_1_TAG);
// Set and save live card remote view to modify it later
mLiveCardRemoveViews = new RemoteViews(getPackageName(), R.layout.livecard1);
mLiveCard.setViews(mLiveCardRemoveViews);
// Publish livecard in REVEAL mode (alternative to SILENT mode)
// Set a PendingIntent to handle livecard actions (like a menu)
Intent intent = new Intent(mContext, MenuActivity.class);
mLiveCard.setAction(PendingIntent.getActivity(mContext, 0, intent, 0));
mLiveCard.publish(LiveCard.PublishMode.REVEAL);
![Page 14: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/14.jpg)
GDK: Immersion
![Page 15: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/15.jpg)
GDK: Immersionpublic class GlassSampleImmersion extends Activity { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);setContentView(R.layout.immersion);
} public boolean onCreateOptionsMenu(Menu menu) {
// Inflate menu as usualMenuInflater inflater = getMenuInflater();inflater.inflate(R.menu.sample3menu, menu);return true;
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Capture tap to display menuif (keyCode == KeyEvent.
KEYCODE_DPAD_CENTER) {openOptionsMenu();
return true;}return false;
}}
![Page 16: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/16.jpg)
GDK: Menús
![Page 17: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/17.jpg)
GDK: CardScrollListView ArrayAdapter
CardScrollView CardScrollAdapter
![Page 18: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/18.jpg)
GDK: CardScroll protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create array of sample cards to use in the adapter
createCards();
// Create view programmatically
mCardScrollView = new CardScrollView(mContext);
CardScrollAdapter adapter = new MyCardAdapter();
mCardScrollView.setAdapter(adapter);
// Important! Views are NOT active by default
mCardScrollView.activate();
// Set activity view as usual
setContentView(mCardScrollView);
}
private class MyCardAdapter extends CardScrollAdapter {
(...)
public View getView(int position, View convertView,
ViewGroup parent) {
// Cards are able to render themselves
return mCards.get(position).toView();
}
}
![Page 19: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/19.jpg)
GDK: Voice Trigger
ok glass,
get directions to…send a message to…make a call to…play music...
ok glass, play music… which artist?
Voice Trigger Voice Trigger Prompt
![Page 20: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/20.jpg)
GDK: Voice Trigger<?xml version="1.0" encoding="utf-8"?><resources> <string name="glass_voice_trigger">play music</string></resources>
1) res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?><trigger keyword="@string/glass_voice_trigger" />
2) res/xml/myTrigger.xml
<activity | service ...><intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" /></intent-filter><meta-data android:name="com.google.android.glass.VoiceTrigger" android:resource="@xml/myTrigger" />
</activity | service>
3) AndroidManifest.xml
![Page 21: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/21.jpg)
GDK: Voice Trigger (Prompt)<?xml version="1.0" encoding="utf-8"?><resources> <string name="glass_voice_trigger">play music</string> <string name="glass_voice_prompt">which artist?</string></resources>
1) res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?><trigger keyword="@string/glass_voice_trigger"> <input prompt="@string/glass_voice_prompt" /></trigger>
2) res/xml/myTrigger.xml
protected void onResume() {
super.onResume();
ArrayList<String> voiceResults = getIntent().getExtras().getStringArrayList(RecognizerIntent.EXTRA_RESULTS);
}
3) Your Glassware Activity
![Page 22: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/22.jpg)
Algunos ejemplos(Código disponible en https://github.com/lgvalle/Glass)
![Page 23: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/23.jpg)
¿Qué cosas no puedo hacer?(Hoy, 20 de Marzo de 2014)
![Page 24: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/24.jpg)
No es posible- Reconocimiento facial
- Submenús de voz
- Reconocimiento de voz offline
- Google Play Services: GCM, Google Maps API v2, new
Location APIs…
- Lanzar apps del teléfono
![Page 25: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/25.jpg)
getLiveCard() is now createLiveCard()- XE12 - 17 Diciembre 2013
- XE11 - 11 Noviembre 2013
- XE10 - 7 Octubre 2013
![Page 27: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/27.jpg)
HackathonDesafío BBVA Desafío
TelepizzaDesafío Estrella
Damm
10 equipos 10 equipos 10 equipos
Equipo
Tres personasNombre de equipocom.hackathon.<desafio>.<equipo>
Google Glass2 unidades por salaRotan cada 5 minutos
![Page 28: Ok Glass... Make me a Sandwich (with code samples)](https://reader033.vdocuments.mx/reader033/viewer/2022052405/58f069bd1a28ab266e8b45f7/html5/thumbnails/28.jpg)
Make it happen!