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
250
BluetoothDevice.getName()に裏切られた話
Moyuru Aizawa
September 01, 2023
Tweet
Share
More Decks by Moyuru Aizawa
See All by Moyuru Aizawa
graphicsLayer
lvla
0
160
Jetpack Composeで画像クロップ機能を実装する
lvla
0
920
Jetpack Compose drag gesture and pinch gesture
lvla
1
3.2k
Jetpack Compose Layout API
lvla
1
600
BLEを使ったアプリを継続的に開発するために
lvla
0
900
RecyclerView.ItemAnimator
lvla
1
280
RecycledViewPool
lvla
1
160
CameraX
lvla
2
2.2k
Hack RecyclerView.ItemDecoration
lvla
5
580
Other Decks in Programming
See All in Programming
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
イベント駆動で成長して委員会
happymana
1
330
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Better Code Design in PHP
afilina
PRO
0
130
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
Click-free releases & the making of a CLI app
oheyadam
2
120
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
cmp.Or に感動した
otakakot
3
200
Featured
See All Featured
Fireside Chat
paigeccino
34
3k
A Philosophy of Restraint
colly
203
16k
GitHub's CSS Performance
jonrohan
1030
460k
A designer walks into a library…
pauljervisheath
204
24k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Thoughts on Productivity
jonyablonski
67
4.3k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Designing for Performance
lara
604
68k
The Cult of Friendly URLs
andyhume
78
6k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
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େ ࣄʹେࣄʹը໘ؒΛӪ͖ճ͠ͱ͘
͓͠·͍