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
Firebaseで解決するAndroidの機種依存 / Firebase solve and...
Search
gyamoto
December 18, 2018
Technology
2
1.3k
Firebaseで解決するAndroidの機種依存 / Firebase solve android device difference
gyamoto
December 18, 2018
Tweet
Share
More Decks by gyamoto
See All by gyamoto
脱Accompanistを考える / Bye Accompanist
gya
0
330
実践 脱Modifier.composed / Let's Modifier.Node
gya
2
710
タクシーアプリ『GO』Androidのリリースフロー / Release GO App
gya
0
1.3k
私の好きなModifier関数 / My Favorite Modifier
gya
0
870
2022年ヘルスケアアプリのつくり方 / 2022 A Healthcare App Odyssey
gya
0
1.3k
タクシーアプリ「GO」AndroidにできるところからJetpack Composeを入れている話 / Introduce Jetpack Compose gradually
gya
0
790
Gradle BOM importでライブラリバージョン管理 / DroidKaigi2019
gya
3
2k
Other Decks in Technology
See All in Technology
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
170
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
MLOps の現場から
asei
6
630
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
210
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Side Projects
sachag
452
42k
Building Applications with DynamoDB
mza
91
6.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Building Your Own Lightsaber
phodgson
103
6.1k
Scaling GitHub
holman
458
140k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Transcript
FirebaseͰղܾ͢Δ Androidͷػछґଘ Kohei Yamamoto
Kohei Yamamoto • ࣾձਓ4ͷAndroidΤϯδχΞ • ઈࢍDroidKaigi2019ͷൃද४උத • teamLabͰಇ͍͍ͯ·͢ • GitHubɿgyamoto
• Twitterɿfarundorl
Androidͷػछґଘ
ࠓճग़ձͬͨػछґଘ Bluetooth Low Energy (BLE) ͷΞυόλΠζΛ͓͜ͳ͏ͱɺ ग़ྗڧ[db]ͱΞυόλΠζִؒ[Hz]͕ػछʹΑͬͯҟͳΔ
Example: startAdvertising // val bleAdvertiser: BluetoothLeAdvertiser bleAdvertiser.startAdvertising( AdvertiseSettings.Builder() .setTxPowerLevel(ADVERTISE_TX_POWER_MEDIUM) .setAdvertiseMode(ADVERTISE_MODE_BALANCED)
.setConnectable(true) .build(), AdvertiseData.Builder() .build(), callback )
Example: startAdvertising // val bleAdvertiser: BluetoothLeAdvertiser bleAdvertiser.startAdvertising( AdvertiseSettings.Builder() .setTxPowerLevel(ADVERTISE_TX_POWER_MEDIUM) .setAdvertiseMode(ADVERTISE_MODE_BALANCED)
.setConnectable(true) .build(), AdvertiseData.Builder() .build(), callback ) ग़ྗڧΛ High, Medium, Low, UltraLow ͔Βઃఆ
Example: startAdvertising // val bleAdvertiser: BluetoothLeAdvertiser bleAdvertiser.startAdvertising( AdvertiseSettings.Builder() .setTxPowerLevel(ADVERTISE_TX_POWER_MEDIUM) .setAdvertiseMode(ADVERTISE_MODE_BALANCED)
.setConnectable(true) .build(), AdvertiseData.Builder() .build(), callback ) ΞυόλΠζִؒΛ LowLatency, Balanced, LowPower ͔Βઃఆ
BLEͷڧͱִ͕ؒػछґଘ • Xperiaܥ: ग़ྗ͕ऑ͍ • Galaxyܥ: ग़ྗΛ্͛ͳ͍ͱΞυόλΠζִ͕ؒ҆ఆ͠ͳ͍ • Huaweiܥ: ΞυόλΠζִ͕ؒ҆ఆͯ͠ͳ͍
※ Huaweiܥࠓճͷํ๏ͰղܾͰ͖ͳ͔ͬͨ
ػछґଘͷݏͳͱ͜Ζ ઃఆಉ͕ͩ͡ɺػछʹΑͬͯ࠷దͳग़ྗڧͱΞυόλΠζ ִ͔ؒΒΕͯ͠·͏ʢͱͯͭΒ͍ʣ ↓↓↓ ػछ͝ͱʹઃఆ͍͚ͨ͠ͲϋʔυίʔσΟϯάͨ͘͠ͳ͍ɻ Firebase UserProperty & RemoteConfigͰύϥϝʔλઃఆ
Firebase UserProperty & RemoteConfig
Firebase UserProperty • ݴޠҬͳͲϢʔβʔΛࣔ͢ଐੑΛઃఆͰ͖ΔϓϩύςΟ • RemoteConfigͳͲFirebaseͷଞαʔϏεͰϢʔβఆͷ ϑΟϧλϦϯάͱͯ͑͠Δ • ϓϩδΣΫτ͝ͱʹ25ݸ·ͰઃఆͰ͖Δ
Firebase RemoteConfig • ཧը໘Ͱઃఆͨ͠Λ৴͢ΔΈ • ΞϓϦ͔Βઃఆ͞ΕͨΛऔಘͯ͠ӬଓԽɺࢀরͰ͖Δ • ΞϓϦΛߋ৽ͤͣʹύϥϝʔλͷมߋA/BςετΛ࣮ݱ ͢ΔͨΊͷσʔλιʔε
UserProperty x RemoteConfig 1. ػछΛಛఆͰ͖ΔใΛUserPropertyʹઃఆ 2. UserProperty͔Βػछ͝ͱͷΛRemoteConfigʹઃఆ 3. RemoteConfigʹΑͬͯΞϓϦͷৼΔ͍͕มΘΔΑ͏࣮
1. ػछใΛUserPropertyʹઃఆ val analytics = FirebaseAnalytics.getInstance(context) // ໊(ྫ: Pixel 3,
SOV34, SC-01F, SHV39) analytics.setUserProperty("device_model", Build.MODEL) // ऀ໊(ྫ: Google, Sony, samsung, SHARP) analytics.setUserProperty(“device_manufacturer", Build.MANUFACTURER)
2. ػछ͝ͱͷΛRemoteConfigʹઃఆ
3. RemoteConfigʹΑͬͯৼΔ͍Λม͑Δ val config = FirebaseRemoteConfig.getInstance() init { // ύϥϝʔλ͝ͱʹσϑΥϧτΛઃఆ
config.setDefaults( "advertise_power" to ADVERTISE_TX_POWER_MEDIUM.toLong(), "advertise_mode" to ADVERTISE_MODE_BALANCED.toLong() ) }
3. RemoteConfigʹΑͬͯৼΔ͍Λม͑Δ val config = FirebaseRemoteConfig.getInstance() // ઃఆ͞ΕͨͷϑΣονɺ༗ޮԽ fun fetch()
{ config.fetch(cacheExpiration).addOnSuccessListener { config.activateFetched() } } val advertisePower: Int get() = config.getLong("advertise_power").toInt() val advertiseMode: Int get() = config.getLong("advertise_mode").toInt()
3. RemoteConfigʹΑͬͯৼΔ͍Λม͑Δ // RemoteConfigͷΛࢀর͢ΔΑ͏ʹஔ͖͑ bleAdvertiser.startAdvertising( AdvertiseSettings.Builder() .setTxPowerLevel(advertisePower) .setAdvertiseMode(advertiseMode) .setConnectable(true) .build(),
AdvertiseData.Builder() .build(), callback ) ϋʔυίʔσΟϯάɺΞϓϦͷߋ৽Λͤͣʹػछґଘʹཱ͔ͪ͏
FirebaseͰղܾ͢ΔAndroidͷػछґଘ 1. ػछΛಛఆͰ͖ΔใΛUserPropertyʹઃఆ 2. UserProperty͔Βػछ͝ͱͷΛRemoteConfigʹઃఆ 3. RemoteConfigʹΑͬͯΞϓϦͷৼΔ͍͕มΘΔΑ͏࣮