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
AwarenessAPI
Search
funnelbit
July 27, 2016
Technology
0
130
AwarenessAPI
funnelbit
July 27, 2016
Tweet
Share
More Decks by funnelbit
See All by funnelbit
Hatena Engineer Seminar #9
funnelbit
5
7.2k
droidkaigi-2017-renovation
funnelbit
10
10k
Dart
funnelbit
0
250
BottomBarAndSnackBar
funnelbit
0
460
Dagger2 Optional bindings
funnelbit
0
530
WearableRecyclerView
funnelbit
1
770
QucikSettingsTileAPI
funnelbit
0
340
Mobile Vision
funnelbit
0
430
Asynchronous Injection
funnelbit
1
230
Other Decks in Technology
See All in Technology
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
複雑なState管理からの脱却
sansantech
PRO
1
150
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
TypeScript、上達の瞬間
sadnessojisan
46
13k
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cult of Friendly URLs
andyhume
78
6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
GitHub's CSS Performance
jonrohan
1030
460k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Building Applications with DynamoDB
mza
90
6.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
What's new in Ruby 2.0
geeforr
343
31k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Transcript
"XBSFOFTT"1* "OESPJE
ࣗݾհ ଜྋ גࣜձࣾͯͳ )BUFOBGVOOFMCJU 5XJUUFS!FYQFSPQFSP
Ϣʔβͷ ͓͔Ε͍ͯΔ ঢ়گΛΔ
ెา͔ɺࣗసं͔
ెา͔ɺࣗసं͔า͍͍ͯ Δͷ͔ɺ͍ͬͯΔͷ͔ɺࢭ ·͍ͬͯΔͷ͔
ెา͔ɺࣗసं͔า͍͍ͯΔͷ͔ɺͬ ͍ͯΔͷ͔ɺࢭ·͍ͬͯΔͷ͔ͱ͋Δൣ ғʹೖ͔ͬͨɺͱ͋Δൣғʹ/ඵډଓ ͚͍ͯΔ͔ɺͱ͋Δൣғ͔Β͔ͨ͠
ెา͔ɺࣗసं͔ɺΓ͔า͍͍ͯΔͷ͔ɺͬ ͍ͯΔͷ͔ɺࢭ·͍ͬͯΔͷ͔ͱ͋Δൣғʹೖͬ ͔ͨɺͱ͋Δൣғʹ/ඵډଓ͚͍ͯΔ͔ɺͱ͋Δ ൣғ͔Β͔ͨ͋͠Δॴ͔Β/ϝʔτϧҠ ಈͨ͠ͱ͋ΔϏʔίϯ͕ݟ͔ͭͬͨɺͱ͋ΔϏʔ ίϯ͕ݟ͔ͭΒͳ͘ͳͬͨͱ͋Δ͔࣌ؒΒҰఆ࣌ ؒܦաͨ͠ϔουϗϯΛ͍ͯ͞͠Δɺͦ͏Ͱͳ͍ ΕͰ͋ΔɻઇͰ͋ΔɻӍͰ͋Δͱಉ࣌ʹɺڧ෩ Ͱ͋ΔɻԹͱ࣪ɻFUDʜ
"XBSFOFTT"1* w Ϣʔβͷঢ়گΛಡΈऔΔ"1* w ָ࣮͕ w ʮਖ਼͍͠ʯσʔλ͕ಘΒΕΔͱ͍ͯ͠Δ w ϝϞϦɺόοςϦʔͷঢ়گΛݟͯಈ͘
"XBSFOFTT"1* w 6TF(PPHMF1MBZ4FSWJDFTWd w &OBCMF"XBSFOFTT"1* w "EEJUJPOBM"1* &OBCMF1MBDFT"1*GPS "OESPJE w
"EEJUJPOBM"1* &OBCMF/FBSCZ.FTTBHFT "1*
"XBSFOFTT"1* mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Awareness.API) .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
@Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { Log.e("onConnectionFailed", "failed"); } }) .build();
4OBQTIPU"1* 'FODF"1*
4OBQTIPU"1*
4OBQTIPU"1* w ۙͷঢ়گΛऔಘ͢Δ w ݱࡏϢʔβϔουϗϯΛ͍ͬͯΔ w ݱࡏϢʔβ͕͍Δॴ w ݱࡏϢʔβ͕͍Δॴͷఱؾ w
FUDʜ
)FBEQIPOF Awareness.SnapshotApi .getHeadphoneState(mGoogleApiClient) .setResultCallback(new ResultCallback<HeadphoneStateResult>() { @Override public void onResult(@NonNull
HeadphoneStateResult headphoneStateResult) { switch (headphoneStateResult.getHeadphoneState().getState()) { case HeadphoneState.PLUGGED_IN : Log.e("ϔουϗϯ", "ૠ͍ͯ͠Δ"); break; case HeadphoneState.UNPLUGGED: Log.e("ϔουϗϯ", "ૠ͍ͯ͠ͳ͍"); break; } } });
8FBUIFS Awareness.SnapshotApi .getWeather(mGoogleApiClient) .setResultCallback(new ResultCallback<WeatherResult>() { @Override public void onResult(@NonNull
WeatherResult weatherResult) { if (weatherResult.getWeather() == null) return; weatherResult.getWeather() .getConditions() } });
8FBUIFSHFU$POEJUJPOT ɾJOU<>ͰఱؾΛฦ͢ $0/%*5*0/@6/,/08/ $0/%*5*0/@$-&"3 $0/%*5*0/@$-06%: $0/%*5*0/@'0((: $0/%*5*0/@)";: $0/%*5*0/@*$:
$0/%*5*0/@3"*/: $0/%*5*0/@4/08: $0/%*5*0/@4503.: PS$0/%*5*0/@8*/%:
'FODF"1*
'FODF"1* w ঢ়ଶʹมԽ͕͋Ε௨ w Ϣʔβ͕า͖࢝Ίͨ w Ϣʔβ͕ࣗసंͰҠಈ͍ͯ͠Δ w Ϣʔβ͕ͱ͋ΔΤϦΞ͔Βͨ͠ w
FUDʜ
TUBSU8BMLJOH AwarenessFence startWakingFence = DetectedActivityFence .starting(DetectedActivityFence.WALKING);
VQEBUF'FODFT Awareness.FenceApi.updateFences(mGoogleApiClient, new FenceUpdateRequest.Builder() .addFence("startWakingFence", startWakingFence, pendingIntent) .build()) .setResultCallback(new ResultCallback<Status>()
{ @Override public void onResult(@NonNull Status status) { if (!status.isSuccess()) {…} } });
'FODF6QEBUF3FRVFTU Awareness.FenceApi.updateFences(mGoogleApiClient, new FenceUpdateRequest.Builder() .addFence("startWakingFence", startWakingFence, pendingIntent) .build()) .setResultCallback(new ResultCallback<Status>()
{ @Override public void onResult(@NonNull Status status) { if (!status.isSuccess()) {…} } });
#SPBEDBTU3FDFJWFS public class MyFenceReceiver extends BroadcastReceiver { … @Override public
void onReceive(Context context, Intent intent) { if (TextUtils.equals(fenceState.getFenceKey(), "startWakingFence")) { switch(fenceState.getCurrentState()) { case FenceState.TRUE:… case FenceState.FALSE:… case FenceState.UNKNOWN:… … } } …
$PNCJOBUJPO'FODF
$PNCJOBUJPO'FODF AwarenessFence.and( DetectedActivityFence .during(DetectedActivityFence.WALKING), HeadphoneFence .during(HeadphoneState.PLUGGED_IN) ); า͍͓ͯΓɺϔουϗϯΛ͚͍ͭͯΔ
$PNCJOBUJPO'FODF AwarenessFence walkingAndPlugInHeadPhoneFence = AwarenessFence.and( DetectedActivityFence.during(DetectedActivityFence.WALKING) , HeadphoneFence.during(HeadphoneState.PLUGGED_IN), AwarenessFence.not(LocationFence.in(35.010974, 135.7612923,
50, 0L)) ); า͍͓ͯΓɺϔουϗϯΛ͚͍ͭͯΔ͕ɺͱ͋ΔॴͷܘN ʹ͍ͳ͍
$PNCJOBUJPO'FODF AwarenessFence.or(AwarenessFence.and( DetectedActivityFence.during(DetectedActivityFence.WALKING) , HeadphoneFence.during(HeadphoneState.PLUGGED_IN), AwarenessFence.not(LocationFence.in(35.010974, 135.7612923, 50, 0L)) ),
BeaconFence.found(…)); า͍͓ͯΓɺϔουϗϯΛ͚͍ͭͯΔ͕ɺͱ͋ΔॴͷܘN ʹ͍ͳ͍ɻ·ͨɺͱ͋ΔϏʔίϯ͕ͦʹݟ͔ͭͬͨɻ
ॴײ w ʮݡ͍ʯػೳΛ࡞Δͷ͕༰қʹͳͬͨ w ͜Μͳʹ؆୯ͳΒͬͯΈΑ͏͔ͱ͍͏ؾʹͳ Δ w Ͳ͏͏·͘͏͔ߟ͑Δඞཁ͕͋Δ
ৄࡉ w IUUQTEFWFMPQFSTHPPHMFDPNBXBSFOFTT w IUUQTEFWFMPQFSTHPPHMFDPNBOESPJE SFGFSFODFDPNHPPHMFBOESPJEHNT BXBSFOFTTQBDLBHFTVNNBSZ w IUUQTEFWFMPQFSTHPPHMFDPNBOESPJE HVJEFTSFMFBTFTKVOF@@@W
͋Γ͕ͱ͏͍͟͝·ͨ͠