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
660
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
950
社内ライブラリのアップデートフロー
wakwak3125
4
3.5k
Wantedly Peopleのリリースフロー
wakwak3125
1
4.3k
KOINかわいいよ、KOIN
wakwak3125
0
820
Other Decks in Technology
See All in Technology
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
複雑なState管理からの脱却
sansantech
PRO
1
150
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
10
1.2k
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
180
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
Taming you application's environments
salaboy
0
200
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Scaling GitHub
holman
458
140k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Unsuck your backbone
ammeep
668
57k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
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ਓن)ͱ͔ͩͱɺͯ͢Λࣗࣾ։ൃͰಠࣗʹ͍ͬͯΔͱ͍͘Β͕࣌ؒ͋ͬͯ Γͳ͍ͷͰɺ͜͏͍ͬͨϫϯετοϓͰ͍Ζ͍ΖͰ͖Δπʔϧඇৗʹॿ͔Δͳ͊ͱ͍͏ҹͰͨ͠ɻ • ͔͠ແྉɻ • ͍Ζ͍Ζফͤͳ͍ɻ • Ճͨ͠ΞϓϦ͕ফͤͳ͍ • Ճͨ͠ϓϩύςΟফͤͳ͍ • σϑΥϧτͰ༻ҙ͞Ε͍ͯΔͷফͤͳ͍ • ͱʹ͔͘ফͤͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠