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
77
Rio Dev Day – Introdução ao Android
douglasdrumond
0
95
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
540
Other Decks in Technology
See All in Technology
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
120
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
200
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
200
Storybook との上手な向き合い方を考える
re_taro
4
540
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
710
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
2
470
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
Taming you application's environments
salaboy
0
200
SDN の Hype Cycle を一通り経験してみて思うこと / Going through the Hype Cycle of SDN
mshindo
1
110
Featured
See All Featured
What's new in Ruby 2.0
geeforr
343
31k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Agile that works and the tools we love
rasmusluckow
327
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Language of Interfaces
destraynor
154
24k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Site-Speed That Sticks
csswizardry
0
33
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
110
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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