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
94
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.3k
waiwai-swiftpm-part2
d_date
3
470
わいわいSwift PM part 1
d_date
2
380
What's new in Firebase 2021
d_date
2
1.4k
CI/CDをミニマルに構築する
d_date
1
540
Swift Package centered project - Build and Practice
d_date
20
13k
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
630
Other Decks in Programming
See All in Programming
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.3k
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
770
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
670
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
280
Package Traits
ikesyo
1
160
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
950
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
240
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
100
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
220
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
880
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
140
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
330
Featured
See All Featured
Unsuck your backbone
ammeep
669
57k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Building Adaptive Systems
keathley
38
2.3k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Music & Morning Musume
bryan
46
6.3k
Six Lessons from altMBA
skipperchong
27
3.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
What's in a price? How to price your products and services
michaelherold
244
12k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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