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
BluetoothDevice.getName()に裏切られた話
Search
Moyuru Aizawa
September 01, 2023
Programming
0
280
BluetoothDevice.getName()に裏切られた話
Moyuru Aizawa
September 01, 2023
Tweet
Share
More Decks by Moyuru Aizawa
See All by Moyuru Aizawa
BLUETOOTH_SCAN and iBeacon
lvla
1
47
graphicsLayer
lvla
0
180
Jetpack Composeで画像クロップ機能を実装する
lvla
0
1k
Jetpack Compose drag gesture and pinch gesture
lvla
1
3.4k
Jetpack Compose Layout API
lvla
1
610
BLEを使ったアプリを継続的に開発するために
lvla
0
930
RecyclerView.ItemAnimator
lvla
1
290
RecycledViewPool
lvla
1
180
CameraX
lvla
2
2.3k
Other Decks in Programming
See All in Programming
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
Androidアプリの One Experience リリース
nein37
0
1.2k
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
良いユニットテストを書こう
mototakatsu
11
3.6k
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
0
150
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
300
AHC041解説
terryu16
0
400
為你自己學 Python
eddie
0
520
rails newと同時に型を書く
aki19035vc
5
710
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
テストコード書いてみませんか?
onopon
2
340
Featured
See All Featured
Code Review Best Practice
trishagee
65
17k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Producing Creativity
orderedlist
PRO
343
39k
Visualization
eitanlees
146
15k
The Invisible Side of Design
smashingmag
299
50k
What's in a price? How to price your products and services
michaelherold
244
12k
Building Applications with DynamoDB
mza
93
6.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
240
Transcript
BluetoothDevice.getName()ʹ ཪΒΕͨ @MoyuruAizawa
Moyuru Aizawa Software Engineer of Catlog, RABO. Previously at Azit,
CyberAgent, and Eureka. Love Metal, Hardcore and EDM. MoyuruAizawa
ಛʹΦνͷͳ͍Λ͠·͢
None
͜ΕΒͷϋʔυΣΞͷηοτΞοϓ Android͔ΒBluetoothܦ༝Ͱߦͬͯ·͢
ϋʔυΣΞͱ BluetoothDevice/BluetoothGatt ͱ͍͏APIΛ௨ͯ͡௨৴͠·͢
BluetoothDevice.getName()Ͱ ϋʔυΣΞͷnameΛऔಘͰ͖·͢
AndroidͷBluetoothLeScannerΛ ͔ͭͬͯपғͷσόΠεΛݕࡧ͢Ε Θ͔Γ·͕͢
CatlogͷϋʔυΣΞʹͯ͢ ݸମݻ༗ͷname͕ઃఆ͞Ε͍ͯ·͢
BluetoothDevice.getName()ͷ ฦΓnullableͷStringͰ͕͢
CatlogͷϋʔυΣΞ૬खͳΒ ඞͣString͕ฦͬͯ͘Δ͜ͱ͕ ظ͞Ε·͢
None
14 betaΛೖΕͯࢼͨ݁͠Ռ BluetoothDevice.getName()ͷڍಈ͕ ͓͔͍͜͠ͱ͕໌
Catlog HomeͷWi-FiઃఆͷͨΊʹ पғͷCatlog HomeΛscan ͜ͷ࣌ͰCatlog Homeͷname͕औಘͰ͖͍ͯΔ
ઃఆϑϩʔΛਐΊͯߦͬͯ ͜ͷը໘Ͱprimary buttonΛԡ͢ͱ ͏ҰBluetoothDevice.getName()Λ͠·͢
͵ΔΆ
લͷը໘Ͱname͕ظ௨Γʹฦͬ ͖͍͕ͯͯͨŊͳ͔ͥnull͕ฦͬͯ͘Δ
ͳͥ…?
ͨΊ͠ʹ͜ͷը໘ͰLaunchedEffectΛ͔ͭͬͯ BluetoothDevice.getName()Λ࣮ߦ͢Δͱ…
ͪΌΜͱname͕ฦͬͯ͘Δ!!
🤔
ࢼ͠ʹŊ͜ͷը໘ΑΓલͷը໘ͰߦΘ Ε͍ͯΔBluetoothGattʹΑΔຊ֨త ͳ௨৴Λͯ͢ল͍ͯΈΔ
primary buttonΛԡͯ͠ BluetoothDevice.getName()Λ࣮ߦ͢Δͱ…
ͪΌΜͱname͕ฦ͖ͬͯͨ!!
ŪƄŴƄŧƄũƄ….
‣ ࠷ॳͷBluetoothDevice.getName()ਖ਼ৗ ‣ ී௨ʹύεϫʔυೖྗը໘ʹભҠ͖ͯͯ͠ŊଓϘλϯԡ͞Εͯ getName -> null ‣ ී௨ʹύεϫʔυೖྗը໘ʹભҠ͖ͯͯ͠ŊLaunchedEffectͰ͍͖ͳ ΓgetName
-> ͱΕΔ ‣ લը໘ΛͿͬͱͯ͠ύεϫʔυೖྗը໘ʹભҠŊ͡Ίͯ BluetoothDeviceͱconnect͢ΔλΠϛϯάͰgetName -> ͱΕΔ ͜͜·ͰͰΘ͔͍ͬͯΔ͜ͱ
BluetoothDevice.getNameͷ υΩϡϝϯτͱ࣮ΛΈͯΈΑ͏
None
None
BluetoothDevice.getName Ωϟογϡͨ͠nameΛଈ࣌ฦ͢ Ωϟογϡ͕ͳ͔ͬͨΒnullʹͳΓ͑ΔŇ ͦΕͦ͏Ň
͍··Ͱ(Android 13·Ͱ)Ͱ؍ଌͨ͜͠ͱͳ͔͕ͬͨ APIͷ༷ͱͯ͠ى͖ಘΔ (ͱ͍͑όάͩͱࢥ͏Μ͚ͩͲ)
ΑʔΘ͔ΒΜ͔Βਖ਼ࣜϦϦʔεΛ·ͪ ͭͭŊͱΓ͋͑ͣҰͱΕͨnameେ ࣄʹେࣄʹը໘ؒΛӪ͖ճ͠ͱ͘
͓͠·͍