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
Remote Configを導入して、Notificationsは導入しませんでした
Search
Ryo Sakaguchi
July 13, 2016
Technology
3
1.3k
Remote Configを導入して、Notificationsは導入しませんでした
Remote ConfigとNotificationとAnalyticsに関してさくっと話しました。
Otemachi_firebase #1
Ryo Sakaguchi
July 13, 2016
Tweet
Share
More Decks by Ryo Sakaguchi
See All by Ryo Sakaguchi
Android Architecture Componentsを使って、改善・効率化するAndroidアプリ開発
wakwak3125
0
1.2k
Test multiple APKs with Robolectric
wakwak3125
0
680
Clip, Elevation and ViewOutlineProvider
wakwak3125
1
1.1k
WebView as Fancy and effective View
wakwak3125
1
1.4k
ViewPager2をちょっとさわってみよう
wakwak3125
0
1.5k
年末だし、振り返るKotlin
wakwak3125
1
970
社内ライブラリのアップデートフロー
wakwak3125
4
3.6k
Wantedly Peopleのリリースフロー
wakwak3125
1
4.4k
KOINかわいいよ、KOIN
wakwak3125
0
840
Other Decks in Technology
See All in Technology
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
350
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
1
16k
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
140
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
180
Building Scalable Backend Services with Firebase
wisdommatt
0
110
When Windows Meets Kubernetes…
pichuang
0
300
Azureの開発で辛いところ
re3turn
0
240
データ基盤におけるIaCの重要性とその運用
mtpooh
4
510
iPadOS18でフローティングタブバーを解除してみた
sansantech
PRO
1
140
なぜfreeeはハブ・アンド・スポーク型の データメッシュアーキテクチャにチャレンジするのか?
shinichiro_joya
2
470
今年一年で頑張ること / What I will do my best this year
pauli
1
220
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
140
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Designing for humans not robots
tammielis
250
25k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Why Our Code Smells
bkeepers
PRO
335
57k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
How GitHub (no longer) Works
holman
312
140k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
Transcript
Remote ConfigΛಋೖͯ͠ɺ Notificationsಋೖ͠·ͤΜͰͨ͠ɻ @wakwak3125 Otemachi Firebase #1
About me ɾࡔޱ ྒʢ͔͙ͪ͞ Γΐ͏ʣ ɾLang-8ͱ͍͏ձࣾͰಇ͍͍ͯ·͢ɻ ɾҰࡢ·ͰՈ۩ͷൢചһΛ͍ͯ͠·ͨ͠ ɾձࣾTwitterͰΘ͘Θ͘͞ΜͱݺΕ͍ͯ·͢
HiNativeʢϋΠωΠςΟϒʣ commitϝοηʔδΛఴͯ͠Β͏ͷΦεεϝͰ͢
Agenda • What’s Remote Config • What’s Notifications • Remote
Config, Pros/Cons • Notifications, Pros/Cons • Analytics with Remote Config
What’s Remote Config?
What’s Remote Config? • ΦϯϥΠϯ্Ͱઃఆͨ͠Λଈ࠲ʹΞϓϦʹಧ͚Δ ͜ͱ͕Ͱ͖Δπʔϧ • A/BςετͷͨΊʹͬͯΈͨΓ • ηάϝϯτຖʹΞϓϦͷڍಈΛ͔͑ͨΓ
• มߋΛΞϓϦͷΞοϓσʔτͳ͠ʹөͤͨ͞Γ • ͋ΔػೳΛ༗ޮԽͨ͠ΓແޮԽͨ͠Γ
Chang the behavior by segments. • ಛఆͷϢʔβʔ͞ΜͷΈʹԿ͔Λද͍ࣔͤͨ͞ • ϨϏϡʔૌٻμΠΞϩά •
ϔϏʔϢʔβʔ͚ͷ͝Ҋ
How to use Remote Config ?
Step1 FirebaseͷґଘؔΛՃ // Add dependencies to app/build.gradle compile 'com.google.firebase:firebase-core:9.2.0' compile
‘com.google.firebase:firebase-config:9.2.0' // Create singleton Remote Config object remoteConfig = FirebaseRemoteConfig.getInstance() val configSettings = FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnable(BuildConfig.DEBUG).build() remoteConfig.setConfigSettings(configSettings)
Step2 σϑΥϧτΛઃఆ // Create default parameter like this. res/xml/remote_config_default_params.xml <defaultsMap>
<entry> <key>show_review_dialog</key> <value>false</value> </entry> </defaultsMap> // set default parameters by “setDefaults()” remoteConfig = FirebaseRemoteConfig.getInstance() remoteConfig.setDefaults(R.xml.remote_config_default_params)
Step3 ύϥϝʔλʔΛRemote ConfigαʔόʔʹConsole͔Β ઃఆ (Review targetʹ͍ͭͯޙड़)
Step4 αʔόʔ͔ΒΛऔಘ // Fetch the parameter from server. override fun
onPostResume() { super.onPostResume() // cacheExpireΛ։ൃ࣌0ʹ͢Δͱɺͷมߋͷ֬ೝΛ͘͢͠ͳΓ·͢ɻ val cacheExpire: Long = 3600L remoteConfig.fetch(cacheExpire) .addOnFailureListener({ Log.d(TAG, "Failure") }) .addOnSuccessListener ({ // औಘͨ͠ύϥϝʔλʔΛ༗ޮԽ͢Δɻ remoteConfig.activateFetched() }) .addOnCompleteListener({ Log.i(TAG, "Complete") })}
Step5 औಘͨ͠ΛͬͯԿ͔͢Δ // Fetch the parameter from server. // Ұऔಘͨ͠Ωϟογϡ͞ΕΔͷͰɺfetch͢Δඞཁͳ͍ɻ
if (remoteConfig.getBoolean(“show_review_dialog”)) { showReviewDialog() }
Point • ެࣜͷυΩϡϝϯτʹॻ͍ͯ͋Γ·͕͢ɺdeveloper modeΛ༗ޮԽ͠ͳ͍ ͱɺfetchճʹ੍ݶ͕ઃఆ͞ΕΔͨΊɺඞͣ༗ޮԽ͠·͠ΐ͏ɻ • ͷfetchεϓϥογϡɺॳճىಈ࣌ʹ·ͱΊͯऔಘ͓͖ͯ͠ɺऔಘՄ൱Λ ࣋ͬͯࠓޙ࠶fetch͢Δ͔Ͳ͏͔Λஅ͢Εྑ͍ͱࢥ͍·͢ɻ • ͦͯ͠fetch()Αࣦ͘ഊ͠·͢ɻ·ͨɺonCreateͰݺͿͱ͔ͳΓͷ֬Ͱࣦ
ഊɺ·ͨηοτ͍ͯ͠ΔOnCompleteListener͕ݺΕ·ͤΜͰͨ͠ɻ work around ͱͯ͠ onPostResumeͰfetchͯ͋͛͠Δ͜ͱͰྑͦ͞͏Ͱ͢ɻ • Ref: http://stackoverflow.com/questions/37501124/firebaseremoteconfig- fetch-does-not-trigger-oncompletelistener-every-time
What’s Notifications ?
What’s Notifications ? • FirebaseͷGROWηΫγϣϯʹҐஔ͚ΒΕ͍ͯΔλʔήςΟ ϯάՄೳͳϓογϡϝοηʔδ৴πʔϧ • ϓογϡ௨ͷ։෧ଌఆ • ϓογϡ௨։෧ޙͷίϯόʔδϣϯΠϕϯτͷଌఆ
• ηάϝϯτ͝ͱʹ৴Մೳ • ΞϓϦͷར༻ଅਐʹͭͳ͕Δ • ϓογϡϝοηʔδૹΓϗʔμΠ
Versatile message targeting. • Analyticsͱͷ࿈ܞͰ͍ΖΜͳλʔήοτ͚ʹϓογϡΛ৴Ͱ͖·͢ɻ • ຊޠֶशऀ͚ʹຊจԽʹؔ͢Δ໘നͦ͏ͳ࣭Λ৴ͨ͠Γ • αϒεΫϦϓγϣϯϓϥϯͷηʔϧΛʮҎલαϒεΫϦϓγϣϯొΛ ͍͕ͯͨ͠ղͯ͠͠·ͬͨਓʯʹ͓Βͤͨ͠Γ…
• Console͔ΒखܰʹϓογϡϝοηʔδΛ࡞Δ͜ͱ͕Ͱ͖ΔͷͰɺඇ։ൃ ऀͷΞϧόΠτ͞Μʹ͓ئ͍͢Δ͜ͱ͕Ͱ͖Δɻ • Analytics࿈ܞͰͲΜͳϢʔβʔʹ৴Ͱ͖Δͳ͊ศརͦ͏ͩͳͱࢥͬͯ ಋೖ
͠Α͏ͱࢥ͍·͕ͨࣙ͠Ί·ͨ͠
Why…? • ΞϓϦ͕ϑΥΞάϥϯυͷ࣌͡Όͳ͍ͱɺConsoleͰ࡞ͬͨϓογϡ௨ͷΞ ΠίϯσʔλΛΧελϚΠζ͢Δ͜ͱ͕Ͱ͖ͳ͔ͬͨͨΊࣙΊͪΌ͍·ͨ͠… • ΞϓϦΛόοΫάϥϯυʹ͍ͯ͠Δਓୡ(જࡏతͳϢʔβʔ͞Μୡ)ΛΞϓϦ ʹͬͯͤ͜͞ΔͨΊʹ͍͔͕ͨͬͨɺཁ݅Λຬͨ͢͜ͱ͕Ͱ͖ͳ͔ͬͨɻ • όοΫάϥϯυঢ়ଶͰɺΞϓϦΛىಈͤ͞Δ͚ͩͰ͖Δ͕ɺͦΕͰΞ ΠίϯͷઃఆͳͲΛConsoleͰͰ͖ͳ͍ͷ͢͜͠ࠔΔͨΊɻ
• ଞʹແྉͰྑ͍αʔϏεΛݟ͚ͭͨɻ • OneSignalͱ͍͏αʔϏε͕ߴػೳ͔ͭૹΓϗʔμΠͰྑ͔ͬͨͰ͢ɻ
Use Remote Config with Firebase Analytics !
Use Remote Config with Analytics • Remote Config͋͘·Ͱɺαʔόʔ͔ΒΛओ มߋͨ͠Γ͢ΔͨΊ͚ͩͷπʔϧɻมߋޙͷӨڹ ԠΛݟΔͨΊʹूܭ࡞ۀ͕ඞཁɻͦ͜·Ͱ
Remote Config͚ͩͰͰ͖·ͤΜɻ • ·ͨɺηάϝϯτΛߜͬͨมߋͷద༻୯ମͰ Ͱ͖·ͤΜɻ
Set up(1/6) • ઌʹઆ໌͍ͯͨ͠ϨϏϡʔૌٻμΠΞϩάΛྫʹઆ ໌͍ͨ͠ͱࢥ͍·͢ɻ • ϨϏϡʔΛॻ͍ͯ΄͍͠ϢʔβʔͷଐੑΛܾΊΔɻ ྫ͑…(HiNativeͷ߹) • ࣭ճ͕10ճҎ্ͷϢʔβʔ͞Μʹରͯ͠Ϩ
ϏϡʔૌٻΛߦ͍ͬͯ·͢ɻ
Set up(2/6) • ଐੑ͕ܾ·ͬͨΒɺ࣍ͦͷϢʔβʔଐੑΛ Analyticsʹઃఆͯ͋͛͠·͠ΐ͏ɻ • ࠓճ͜Μͳײ͡ʹͯ͠Έ·ͨ͠ɻ
Set up(3/6) • ઌ΄Ͳ࡞ͬͨϓϩύςΟΛݩʹΦʔσΟΤϯεΛ࡞ ͠·͢ɻ
Set up(4/6) ࠷ޙʹɺΞϓϦଆ͔ΒϢʔβʔϓϩύςΟΛૹ ৴͠·͢ɻ // ϨϏϡʔରϢʔβʔͷ࣭ͷ͖͍͠ // ͜͜ͷɺRemoteConfigͰઃఆ͓͚ͯ͠ɺϨϏϡʔରʹ͢ΔϢʔβʔͷ࣭ Λ͍ͭͰม͑Δ͜ͱ͕Ͱ͖·͢ɻ val
threshold = 10 // numberOfQuestionsΞϓϦΛ༻͍ͯ͠ΔϢʔβʔͷ࣭ val reviewTarget = (numberOfQuestions >= threshold).toString() // Firebase AnalyticsʹϢʔβʔϓϩύςΟΛૹ৴ firebaseAnalytics.setUserProperty(“review_target”, reviewTarget)
Set up(5/6) • Analyticsʹઃఆͨ͠ϓϩύςΟΛݩʹɺRemote Config ʹ݅ΛՃ͠·͢ɻ
Set up(6/6) • Remote Configͷύϥϝʔλʔʹ݅Λద༻͠·͢ɻ ݅ͷΛՃ -> Review targetΛબ
͕࣌ؒΞϨ͢͜ͱ • Remote Configͬͯͯؾ͍ͮͨ͜ͱͱ͔ • A/BςετάϧʔϐϯάͳͲ͕Ͱ͖ͳ͍ͷͰɺҰ࿈ͷྲྀΕͳͲΛςετ͢Δ߹ͪΐͬͱ͕͋Δɻʢνϡʔ τϦΞϧͷҰ࿈ͷςΩετͷςετʣ • ύοͱࢥ͍͍ͭͨͷɺRemote Configͷʹจࣈͷ੍ݶ͕΄΅΄΅ແ͍ͷͰɺJSONͳΜ͔ΛೖΕ͓͍ͯ
ͯɺͦΕΛύʔεͯ͠͏Α͏ʹ͢Εɺॊೈʹมߋ͔ͭάϧʔϐϯά͕Ͱ͖ΔΜ͡Όͳ͍͔ͳͱࢥ͍·ͨ͠ɻ • FirebaseશମΛ௨ͯ͠ࢥͬͨ͜ͱ • Lang-8ͷΑ͏ͳখنͳձࣾ(5ਓن)ͱ͔ͩͱɺͯ͢Λࣗࣾ։ൃͰಠࣗʹ͍ͬͯΔͱ͍͘Β͕࣌ؒ͋ͬͯ Γͳ͍ͷͰɺ͜͏͍ͬͨϫϯετοϓͰ͍Ζ͍ΖͰ͖Δπʔϧඇৗʹॿ͔Δͳ͊ͱ͍͏ҹͰͨ͠ɻ • ͔͠ແྉɻ • ͍Ζ͍Ζফͤͳ͍ɻ • Ճͨ͠ΞϓϦ͕ফͤͳ͍ • Ճͨ͠ϓϩύςΟফͤͳ͍ • σϑΥϧτͰ༻ҙ͞Ε͍ͯΔͷফͤͳ͍ • ͱʹ͔͘ফͤͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠