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
RubyLSPのマルチバイト文字対応
notfounds
0
120
ヤプリ新卒SREの オンボーディング
masaki12
0
130
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
100
Better Code Design in PHP
afilina
PRO
0
130
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
C++でシェーダを書く
fadis
6
4.1k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Featured
See All Featured
Done Done
chrislema
181
16k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Adopting Sorbet at Scale
ufuk
73
9.1k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Making Projects Easy
brettharned
115
5.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Code Review Best Practice
trishagee
64
17k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
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େ ࣄʹେࣄʹը໘ؒΛӪ͖ճ͠ͱ͘
͓͠·͍