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
95
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.4k
waiwai-swiftpm-part2
d_date
3
480
わいわいSwift PM part 1
d_date
2
380
What's new in Firebase 2021
d_date
2
1.4k
CI/CDをミニマルに構築する
d_date
1
550
Swift Package centered project - Build and Practice
d_date
20
14k
How to write Great Proposal
d_date
4
1.2k
Thinking about Architecture for SwiftUI
d_date
8
2.3k
Integrate your app to modern world in Niigata
d_date
0
650
Other Decks in Programming
See All in Programming
PHPのバージョンアップ時にも役立ったAST
matsuo_atsushi
0
170
楽しく向き合う例外対応
okutsu
0
520
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
580
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
5
390
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
ML.NETで始める機械学習
ymd65536
0
210
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
950
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1.1k
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
850
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
280
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
840
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
ytake
0
110
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Side Projects
sachag
452
42k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
A better future with KSS
kneath
238
17k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.6k
Automating Front-end Workflow
addyosmani
1368
200k
Agile that works and the tools we love
rasmusluckow
328
21k
GitHub's CSS Performance
jonrohan
1030
460k
The Invisible Side of Design
smashingmag
299
50k
The Language of Interfaces
destraynor
156
24k
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