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
CI改善もDatadogとともに
taumu
0
190
Jasprが凄い話
hyshu
0
100
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
260
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
8
1.3k
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
970
Jakarta EE meets AI
ivargrimstad
0
290
ソフトウェアエンジニアの成長
masuda220
PRO
12
2.1k
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
190
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
250
技術を改善し続ける
gumioji
0
110
5分で理解する SOLID 原則 #phpcon_nagoya
shogogg
1
290
Bedrock Agentsレスポンス解析によるAgentのOps
licux
3
910
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
223
9.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Optimizing for Happiness
mojombo
376
70k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
How STYLIGHT went responsive
nonsquared
98
5.4k
Become a Pro
speakerdeck
PRO
26
5.2k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
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