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.1k
droidkaigi-2017-renovation
funnelbit
10
10k
Dart
funnelbit
0
250
BottomBarAndSnackBar
funnelbit
0
460
Dagger2 Optional bindings
funnelbit
0
530
WearableRecyclerView
funnelbit
1
760
QucikSettingsTileAPI
funnelbit
0
340
Mobile Vision
funnelbit
0
430
Asynchronous Injection
funnelbit
1
220
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
27
12k
ガチ勢によるPipeCD運用大全〜滑らかなCI/CDを添えて〜 / ai-pipecd-encyclopedia
cyberagentdevelopers
PRO
3
210
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
大規模データ基盤チームのオンプレTiDB運用への挑戦 / dpu-tidb
cyberagentdevelopers
PRO
1
110
急成長中のWINTICKETにおける品質と開発スピードと向き合ったQA戦略と今後の展望 / winticket-autify
cyberagentdevelopers
PRO
1
160
AWSコンテナ本出版から3年経った今、もし改めて執筆し直すなら / If I revise our container book
iselegant
15
4k
30万人が利用するチャットをFirebase Realtime DatabaseからActionCableへ移行する方法
ryosk7
5
350
AWS CodePipelineでコンテナアプリをデプロイした際に、古いイメージを自動で削除する
smt7174
1
100
独自ツール開発でスタジオ撮影をDX!「VLS(Virtual LED Studio)」 / dx-studio-vls
cyberagentdevelopers
PRO
1
180
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
7
1.5k
Amazon_CloudWatch_ログ異常検出_導入ガイド
tsujiba
4
1.6k
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
530
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Visualization
eitanlees
144
15k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Bash Introduction
62gerente
608
210k
A Tale of Four Properties
chriscoyier
156
23k
Ruby is Unlike a Banana
tanoku
96
11k
Writing Fast Ruby
sferik
626
61k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
Side Projects
sachag
452
42k
Making Projects Easy
brettharned
115
5.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
How STYLIGHT went responsive
nonsquared
95
5.2k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠