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
260
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
39
graphicsLayer
lvla
0
170
Jetpack Composeで画像クロップ機能を実装する
lvla
0
970
Jetpack Compose drag gesture and pinch gesture
lvla
1
3.3k
Jetpack Compose Layout API
lvla
1
610
BLEを使ったアプリを継続的に開発するために
lvla
0
920
RecyclerView.ItemAnimator
lvla
1
290
RecycledViewPool
lvla
1
170
CameraX
lvla
2
2.3k
Other Decks in Programming
See All in Programming
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
fs2-io を試してたらバグを見つけて直した話
chencmd
0
230
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
380
Refactor your code - refactor yourself
xosofox
1
260
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
testcontainers のススメ
sgash708
1
120
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
420
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
php-conference-japan-2024
tasuku43
0
290
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
770
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Bash Introduction
62gerente
608
210k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
How GitHub (no longer) Works
holman
311
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Optimizing for Happiness
mojombo
376
70k
The Cult of Friendly URLs
andyhume
78
6.1k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Faster Mobile Websites
deanohume
305
30k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Become a Pro
speakerdeck
PRO
26
5k
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େ ࣄʹେࣄʹը໘ؒΛӪ͖ճ͠ͱ͘
͓͠·͍