Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Primeiros Passos com Google Fit
Search
Douglas Kayama
May 07, 2016
Technology
0
190
Primeiros Passos com Google Fit
3 anos de Android Meetup – GDG São Paulo
Douglas Kayama
May 07, 2016
Tweet
Share
More Decks by Douglas Kayama
See All by Douglas Kayama
TensorFlow no Android – v2
douglasdrumond
0
28
BLE
douglasdrumond
0
29
TensorFlow no Android
douglasdrumond
0
19
Firebase or Realm?
douglasdrumond
0
78
Rio Dev Day – Introdução ao Android
douglasdrumond
0
97
Google I/O
douglasdrumond
0
61
Criando apps com alto nível de qualidade (versão longa)
douglasdrumond
0
37
Criando apps com alto nível de qualidade (versão curta)
douglasdrumond
0
25
RxJava
douglasdrumond
5
550
Other Decks in Technology
See All in Technology
AWS re:Invent 2024 ふりかえり勉強会
yhana
0
460
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
180
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
280
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
280
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
Storage Browser for Amazon S3
miu_crescent
1
290
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.9k
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
140
最近のSfM手法まとめ
kwchrk
2
250
APIとはなにか
mikanichinose
0
110
.NET 9 のパフォーマンス改善
nenonaninu
0
1.3k
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
160
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Typedesign – Prime Four
hannesfritz
40
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Building an army of robots
kneath
302
44k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Cult of Friendly URLs
andyhume
78
6.1k
RailsConf 2023
tenderlove
29
940
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Transcript
Primeiros Passos com Google Fit Douglas Drumond @douglasdrumond
@douglasdrumond O que é o Google Fit?
@douglasdrumond Sensors Activity History
@douglasdrumond Sugestões de apps • Health/Fitness • Wearable sensor based
• Personal analytics (quantified self)
@douglasdrumond Capacidades • Activity • Heart rate • Location •
Nutrition • Power • Speed • Weight • Workout • Strength • Weight Lift • Crossfit • Interval Training • High Intensity Interval Training
@douglasdrumond 3rd party • Nike Fuel • Adidas • Jump
• Hustle • Quickness
@douglasdrumond IMPORTANTE!
@douglasdrumond Seja responsável • Terms and conditions bla bla bla
• RESPEITE O USUÁRIO
@douglasdrumond ARQUITETURA
@douglasdrumond Arquitetura
@douglasdrumond Arquitetura
@douglasdrumond Fitness store • Cloud • Apps em plataformas diferentes
• Apps diferentes
@douglasdrumond Arquitetura
@douglasdrumond Vamos detalhar?
@douglasdrumond Sensor framework • Data sources • Data types •
Data points • Datasets • Sessions
@douglasdrumond Data sources • Sensores • Hardware ou software
@douglasdrumond Data type • Tipos de dados, ex: passos, bpm,
localização • Define um schema • Nome e lista de campos
@douglasdrumond Data points • Array de valores • Timestamp ou
time range
@douglasdrumond Datasets • Conjunto de data points • Mesmo tipo
• Queries (respostas)
@douglasdrumond Sessions • Intervalo de tempo • Organização de dados
@douglasdrumond #soudev
@douglasdrumond Setup
@douglasdrumond Console do Google • Pegar o SHA1 via keytool
• Cadastrar novo client ID • Depende do nome do pacote e assinatura
@douglasdrumond Gradle dependencies { compile 'com.google.android.gms:play-services-fitness:8.4.0' }
@douglasdrumond Construa o client mClient = new GoogleApiClient.Builder(this) .addApi(Fitness.SENSORS_API) .addScope(new
Scope(Scopes.FITNESS_LOCATION_READ)) .addConnectionCallbacks(…) .build();
@douglasdrumond Leia dados Fitness.SensorsApi.findDataSources(mClient, new DataSourcesRequest.Builder() .setDataTypes(DataType.TYPE_LOCATION_SAMPLE) .setDataSourceTypes(DataSource.TYPE_RAW) .build()) .setResultCallback(new
ResultCallback<…>() … for (DataSource dataSource : dataSourcesResult.getDataSources()) { registerFitnessDataListener(dataSource, DataType.TYPE_LOCATION_SAMPLE); } } } });
@douglasdrumond registerFitnessDataListener mListener = new OnDataPointListener() { public void onDataPoint(DataPoint
dataPoint) { for (Field field : dataPoint.getDataType().getFields()) { Value val = dataPoint.getValue(field); Log.i(TAG, "Detected DataPoint field: " + field.getName()); Log.i(TAG, "Detected DataPoint value: " + val); } } };
@douglasdrumond registerFitnessDataListener Fitness.SensorsApi.add(mClient, new SensorRequest.Builder() .setDataSource(dataSource).setDataType(dataType) .setSamplingRate(10, TimeUnit.SECONDS).build(), mListener) .setResultCallback(new
ResultCallback<Status>() { @Override public void onResult(Status status) { if (status.isSuccess()) {Log.i(TAG, "Listener registered!”); } else { Log.i(TAG, "Listener not registered.”); } } });
@douglasdrumond Alguns exemplos DataSource nutritionSource = new DataSource.Builder() .setDataType(DataType.TYPE_NUTRITION) ...
.build(); DataPoint banana = DataPoint.create(nutritionSource); banana.setTimestamp(now.getMillis(), TimeUnit.MILLISECONDS); banana.getValue(Field.FIELD_FOOD_ITEM).setString("banana"); banana.getValue(Field.FIELD_MEAL_TYPE).setInt(Field.MEAL_TYPE_SNACK); banana.getValue(Field.FIELD_NUTRIENTS).setKeyValue(Field.NUTRIENT_POT ASSIUM, 422f)
@douglasdrumond Tópicos não cobertos • Recording API • History API
• Sessions API • BLE API • Config API (Custom Data Types)
@douglasdrumond Samples • https://github.com/googlesamples/android-fit
@douglasdrumond Quero Saber Mais • https://developers.google.com/fit/ • slack.androiddevbr.org
@douglasdrumond Obrigado! •
[email protected]
• @douglasdrumond • +DouglasDrumond • www.cafelinear.com