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
670
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
960
社内ライブラリのアップデートフロー
wakwak3125
4
3.5k
Wantedly Peopleのリリースフロー
wakwak3125
1
4.4k
KOINかわいいよ、KOIN
wakwak3125
0
830
Other Decks in Technology
See All in Technology
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
270
MLOps の現場から
asei
6
650
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
130
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
110
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
540
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
170
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.4k
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
160
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
160
Featured
See All Featured
Visualization
eitanlees
146
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
It's Worth the Effort
3n
183
28k
Statistics for Hackers
jakevdp
796
220k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Building Your Own Lightsaber
phodgson
103
6.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
A Tale of Four Properties
chriscoyier
157
23k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
What's in a price? How to price your products and services
michaelherold
243
12k
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ਓن)ͱ͔ͩͱɺͯ͢Λࣗࣾ։ൃͰಠࣗʹ͍ͬͯΔͱ͍͘Β͕࣌ؒ͋ͬͯ Γͳ͍ͷͰɺ͜͏͍ͬͨϫϯετοϓͰ͍Ζ͍ΖͰ͖Δπʔϧඇৗʹॿ͔Δͳ͊ͱ͍͏ҹͰͨ͠ɻ • ͔͠ແྉɻ • ͍Ζ͍Ζফͤͳ͍ɻ • Ճͨ͠ΞϓϦ͕ফͤͳ͍ • Ճͨ͠ϓϩύςΟফͤͳ͍ • σϑΥϧτͰ༻ҙ͞Ε͍ͯΔͷফͤͳ͍ • ͱʹ͔͘ফͤͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠