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
Can We Measure Developer Productivity?
ewolff
1
150
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
5
590
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
AIチャットボット開発への生成AI活用
ryomrt
0
170
Terraform Stacks入門 #HashiTalks
msato
0
350
フルカイテン株式会社 採用資料
fullkaiten
0
40k
Engineer Career Talk
lycorp_recruit_jp
0
110
Lexical Analysis
shigashiyama
1
150
TypeScript、上達の瞬間
sadnessojisan
46
13k
AGIについてChatGPTに聞いてみた
blueb
0
130
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Speed Design
sergeychernyshev
24
610
How to Ace a Technical Interview
jacobian
276
23k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Being A Developer After 40
akosma
86
590k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Fireside Chat
paigeccino
34
3k
Thoughts on Productivity
jonyablonski
67
4.3k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠