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
470
Dagger2 Optional bindings
funnelbit
0
540
WearableRecyclerView
funnelbit
1
770
QucikSettingsTileAPI
funnelbit
0
350
Mobile Vision
funnelbit
0
440
Asynchronous Injection
funnelbit
1
230
Other Decks in Technology
See All in Technology
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
210
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
160
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
12
3.4k
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
66
4.5k
Automating Front-end Workflow
addyosmani
1366
200k
Code Reviewing Like a Champion
maltzj
520
39k
Designing for humans not robots
tammielis
250
25k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Scaling GitHub
holman
458
140k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠