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
100
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
2
1.5k
waiwai-swiftpm-part2
d_date
3
510
わいわいSwift PM part 1
d_date
2
410
What's new in Firebase 2021
d_date
2
1.5k
CI/CDをミニマルに構築する
d_date
1
580
Swift Package centered project - Build and Practice
d_date
20
14k
How to write Great Proposal
d_date
4
1.6k
Thinking about Architecture for SwiftUI
d_date
8
2.4k
Integrate your app to modern world in Niigata
d_date
0
670
Other Decks in Programming
See All in Programming
関数型まつりレポート for JuliaTokai #22
antimon2
0
150
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
250
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
380
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
450
WindowInsetsだってテストしたい
ryunen344
1
190
Is Xcode slowly dying out in 2025?
uetyo
1
190
NPOでのDevinの活用
codeforeveryone
0
250
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
360
GoのGenericsによるslice操作との付き合い方
syumai
3
690
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
440
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
980
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
400
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
The Language of Interfaces
destraynor
158
25k
Site-Speed That Sticks
csswizardry
10
660
How to train your dragon (web standard)
notwaldorf
93
6.1k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
Optimizing for Happiness
mojombo
379
70k
Navigating Team Friction
lara
187
15k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
210
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.3k
Docker and Python
trallard
44
3.4k
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