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
FirebaseOverview.pdf
Search
d_date
September 01, 2018
Programming
0
83
FirebaseOverview.pdf
DevFest Tokyo 2018
d_date
September 01, 2018
Tweet
Share
More Decks by d_date
See All by d_date
TCA Practice in 5 min
d_date
1
580
waiwai-swiftpm-part2
d_date
2
370
わいわいSwift PM part 1
d_date
2
340
What's new in Firebase 2021
d_date
2
1.3k
CI/CDをミニマルに構築する
d_date
1
480
Swift Package centered project - Build and Practice
d_date
20
12k
How to write Great Proposal
d_date
1
500
Thinking about Architecture for SwiftUI
d_date
8
2.1k
Integrate your app to modern world in Niigata
d_date
0
580
Other Decks in Programming
See All in Programming
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
960
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
340
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
370
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
180
Let's learn code review
riofujimon
2
410
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
180
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
280
Anthropic Cookbook のおすすめレシピ
schroneko
7
980
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
Java 22 Overview
kishida
1
180
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Typedesign – Prime Four
hannesfritz
36
2.1k
How to name files
jennybc
65
93k
Six Lessons from altMBA
skipperchong
21
3k
How STYLIGHT went responsive
nonsquared
92
4.8k
Statistics for Hackers
jakevdp
789
220k
Code Reviewing Like a Champion
maltzj
514
39k
Product Roadmaps are Hard
iamctodd
44
9.7k
How GitHub (no longer) Works
holman
304
140k
Transcript
Firebase Overview for Native Application Daiki Matsudate (@d_date) GDG DevFest
Tokyo 2018
Daiki Matsudate @d_date FOLIO Co., Ltd.
͜ͷຊͷಋೖతͳͰ͢
https://booth.pm/ja/ items/835645
None
Agenda • ͱΓ͋͑ͣೖΕ͍ͨFirebase • Prediction·ΘΓͷ • Firestore·ΘΓͷ
લఏ
1. iOSΤϯδχΞͰ͢
2. Έͳ͞ΜͰͭ͘Δ ηογϣϯͰ͢
͘ઙ͍ͯ͘͘͠͠ͷͰ ࣭ߟ͑ͱ͍͍ͯͩ͘͞
ͱΓ͋͑ͣೖΕ͍ͨ Firebase
ͱΓ͋͑ͣೖΕ͍ͨFirebase • Crashlytics • Performance Monitoring • Google Analytics for
Firebase • App Indexing
None
• ΞϓϦͷΫϥογϡϩάΛऩूɾղੳ͢Δ͓ͳ͡Έͷπʔ ϧ • Fabric ͕ Googleʹങऩ͞Ε͔ͯΒ౷߹͕ਐΊΒΕɺ2017 10݄ʹ౷߹ (Crash Reportingdeprecated)
• Cloud Functionͱ࿈ܞՄೳ
None
- Automatic Trace • ΞϓϦͷύϑΥʔϚϯεΛଌఆ͢Δ • Automatic trace • App
start • Network • App in foreground / background • Screen
- Screen Trace iOS keyWindowʹ͋ΔUIViewControllerͷ ɾStart: viewDidAppear:͕ݺΕͨͱ͖ ɾStop: viewDidDisappear:͕ΑΕͨͱ͖ɻ ※Container
View ControllerͰΩϟϓνϟ͠ͳ͍
Android ͯ͢ͷActivityͷ ɾStart: onActivityStarted()͕ݺΕͨͱ͖ ɾStop: onActivityStopped()͕ݺΕͨͱ͖ - Screen Trace
https://www.youtube.com/watch?v=e-8fiv-vteQ&t=16
https://www.youtube.com/watch?v=e-8fiv-vteQ&t=16
NetworkΛτϨʔε͢Δࡍͷҙ • ඪ४ͷAPIҎ֎ʢϨϕϧAPISocket௨৴ͳ Ͳʣͷ߹ࣗಈτϨʔε͞Εͳ͍
Appendix: Performance Monitoring - Custom Trace let trace = Performance.startTrace(name:
"request_trace") let contents: String do { contents = try String(contentsOfFile: fileName, encoding: .utf8) } catch { print("Log file doesn't exist yet") contents = "" } let fileLength = contents.lengthOfBytes(using: .utf8) trace?.incrementMetric("log_file_size", by: Int64(fileLength))
let trace = Performance.startTrace(name: "request_trace") let contents: String do {
contents = try String(contentsOfFile: fileName, encoding: .utf8) } catch { print("Log file doesn't exist yet") contents = "" } let fileLength = contents.lengthOfBytes(using: .utf8) trace?.incrementMetric("log_file_size", by: Int64(fileLength)) 1. Call startTrace with 2. Set your metric with Appendix: Performance Monitoring - Custom Trace
let target = "https://www.google.com/images/branding/googlelogo/2x/ googlelogo_color_272x92dp.png" guard let targetUrl = URL(string:
target) else { return } guard let metric = HTTPMetric(url: targetUrl, httpMethod: .get) else { return } metric.start() var request = URLRequest(url:targetUrl) request.httpMethod = "GET" let task = URLSession.shared.dataTask(with: request) { data, response, error in if let httpResponse = response as? HTTPURLResponse { metric.responseCode = httpResponse.statusCode } metric.stop() ɾSpecified network trace Appendix: Performance Monitoring - Custom Trace
let target = "https://www.google.com/images/branding/googlelogo/2x/ googlelogo_color_272x92dp.png" guard let targetUrl = URL(string:
target) else { return } guard let metric = HTTPMetric(url: targetUrl, httpMethod: .get) else { return } metric.start() var request = URLRequest(url:targetUrl) request.httpMethod = "GET" let task = URLSession.shared.dataTask(with: request) { data, response, error in if let httpResponse = response as? HTTPURLResponse { metric.responseCode = httpResponse.statusCode } metric.stop() 1. Initialize HTTPMetric 3. Call stop() when finished 2.Call start() ɾSpecified network trace Appendix: Performance Monitoring - Custom Trace
Google Analytics for Firebase
Google Analytics for Firebase • ϞόΠϧ͚Google Analytics • WebͷGoogle Analytics
• BigQuery -> Data Studioͱ͍͏ར༻Λఆ • WebଆͷGAͱ౷߹͢ΔͷʹTag ManagerΛͬͨΓ͢Δ
App Index
App Index • ݕࡧ݁ՌʹΞϓϦΛදࣔ͢Δ • μϯϩʔυϘλϯ͖ͭ • iOS: Universal LinksΛ༗ޮʹ
• Android: AppIndexͷϥΠϒϥϦΛೖΕΔ • apple-app-site-associationΛϗετ͢Δ
ͱΓ͋͑ͣೖΕ͍ͨFirebase ·ͣೖΕͯΈΑ͏ͥʂ
Predictionपล
Firebase Prediction • 7ؒͷσʔλΛݩʹϢʔβʔͷ࣍ͷߦಈΛ༧ଌ ͢Δ • ʮͦ͠͏(churn)ʯʮ͠ͳͦ͞͏ʯʮ՝ۚ ͦ͠͏(purchase)ʯʮ՝ۚ͠ͳͦ͞͏ʯͷ̐ଐੑ ΛσϑΥϧτͰਪଌͰ͖Δ •
AnalyticsͷEventΛݩʹΧελϜ͢Δ͜ͱͰ͖Δ
Prediction x Remote Config • PredictionͰ༧ଌͨ͠Ϣʔβʔଐੑʹରͯ͠ɺ Remote ConfigΛઃఆͰ͖Δ → ʮͦ͠͏ʯͳϢʔβʔʹରͯ͠ɺΩϟϯϖʔ
ϯΛଧͭ
A/B Testing • ରͷϢʔβʔଐੑΛࢦఆͯ͠ɺA/BςετͰ͖Δ • ςετରʹPredictionͰ༧ଌͨ͠ଐੑར༻Մೳ
Prediction x Messaging • PredictionͰ༧ଌͨ͠Ϣʔβʔଐੑʹରͯ͠ɺNotification ΛൃՐͰ͖Δ → ʮͦ͠͏ʯͳϢʔβʔʹରͯ͠ɺ௨ΛૹΔ
In-app messaging
None
None
None
Predictionपล • PredictionͰϢʔβʔͷߦಈΛ༧ଌ • ༧ଌͰ͖ͨΒ࿈ܞ͢Δ • A / B Testing
• Cloud Messaging • In-App Messaging
Firestoreपล
Firestoreपล • Firebase Realtime Database • Firebase Firestore • Firebase
Cloud Function
Firebase Database
• NoSQL cloud database • Realtime Data Sync with JSON
Tree • Available data on offline Firebase Database
Firebase Database
NoSQL
NoSQL = Denormalization
Denormalization in NoSQL { "users": { "user1": { "name": "Alice"
}, "user2": { "name": "Bob" } }, "links": { "link1": { "title": "Example", "href": "http://example.org", "submitted": "user1" } }, "comments": { "comment1": { "link": "link1", "body": "This is awesome!", "author": "user2" } } }
Denormalization in NoSQL { "users": { "user1": { "name": "Alice"
}, "user2": { "name": "Bob" } }, "links": { "link1": { "title": "Example", "href": "http://example.org", "submitted": "user1" } }, "comments": { "comment1": { "link": "link1", "body": "This is awesome!", "author": "user2" } } }
Denormalization in NoSQL { "users": { "user1": { "name": "Alice"
}, "user2": { "name": "Bob" } }, "links": { "link1": { "title": "Example", "href": "http://example.org", "submitted": "user1" } }, "comments": { "comment1": { "link": "link1", "body": "This is awesome!", "author": "user2" } } } Join data in client
• 10:40 - Firestore Database Design / Room I •
13:30 - Realtime Database for High traffic production application / Room J • 14:50 - Realtime Database in Production / Room C + D • Related Session
• NoSQL cloud database • Realtime Data Sync with JSON
Tree • Available data on offline Firebase Database
Cloud Firestore
• Stores data in documents organized in collections • Sending
data with protobuf, which have more types • Introduced reference type, so requires less denormalization and data flattening • Indexed queries with compound sorting and filtering Cloud Firestore
Cloud Firestore
Cloud Firestore Reference type
None
Cloud Functions • FirebaseHTTPϦΫΤετΛτϦΨʔʹͯ͠ɺόοΫΤ ϯυͷίʔυΛ࣮ߦ͢Δ • ίʔυGoogle ͷCloudʹϓογϡ͢Δ
Cloud Functions • Cloud Firestore • Realtime Database • Firebase
Authentication • Google Analytics for Firebase • Crashlytics • Cloud Storage • Cloud Pub/Sub • HTTP
Ex: Cloud Firestore • υΩϡϝϯτ͕ੜ͞Εͨͱ͖ • υΩϡϝϯτ͕ߋ৽͞Εͨͱ͖ • υΩϡϝϯτ͕আ͞Εͨͱ͖ •
্هͷΠϕϯτ͕ൃੜͨ͠ͱ͖
Use Case: Firestore x Function • AlgoliaʹΑΔશจݕࡧ • BigQuery •
etc…
Recap • ͱΓ͋͑ͣೖΕ͓͖͍ͯͨFirebase • Predictionͱͦͷपล • ௨ͱͦͷपล • Databaseͱͦͷपล
Thank you!
Q & A