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
Firebaseを使ってみた
Search
Katsuya Kato
February 24, 2016
Technology
0
49
Firebaseを使ってみた
関西モバイルアプリ研究会 #11 資料
Katsuya Kato
February 24, 2016
Tweet
Share
More Decks by Katsuya Kato
See All by Katsuya Kato
複業メンバーと共に創るカウシェ
katsuyax
0
740
AndroidThingsとFirebaseで始めるホームセキュリティ / Android Things Home Security
katsuyax
2
5.4k
WWDCでこの先生きのこるには / WWDC2017
katsuyax
0
100
watchOS3の新機能 / watchos3
katsuyax
0
96
iPhone(iOS)のアプリ内課金 / in app purchase
katsuyax
0
110
Other Decks in Technology
See All in Technology
Tebiki Engineering Team Deck
tebiki
0
24k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
270
Oracle AI Database移行・アップグレード勉強会 - RAT活用編
oracle4engineer
PRO
0
100
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
230
Webhook best practices for rock solid and resilient deployments
glaforge
2
300
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
250
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
600
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
Red Hat OpenStack Services on OpenShift
tamemiya
0
120
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
2
3k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Abbi's Birthday
coloredviolet
1
4.8k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
180
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
650
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
50k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
330
Measuring & Analyzing Core Web Vitals
bluesmoon
9
760
Transcript
'JSFCBTFΛͬͯΈͨ ,BUTVZB,BUP
ࣗݾհ w Ճ౻উ w ΈࠐΈۀք͔ΒϞόΠϧۀքʹ ͖ͬͯͯ w ڈʹຊग़͠·ͨ͠
'JSFCBTFΛ ͬͯΈͨΛ͠·͢
'JSFCBTFͱ w ݄ʹ(PPHMFʹങऩ͞Εͨ#BB4ʢ#BDLFOEBTB 4FSWJDFʣ w ετϨʔδɺϢʔβʔཧͳͲΞϓϦέʔγϣϯͷόοΫΤϯ υͱͯ͠ඞཁͱͳΔػೳΛαʔϏεΛఏڙͯ͘͠ΕΔ w νϟοτΞϓϦͷΑ͏ͳϦΞϧλΠϜʹσʔλΛಉظ͢Δඞཁ ͕͋ΔαʔϏεʹద͍ͯ͠Δ
w /P42-ɻ+40/ΦϒδΣΫτͱͯ͠อ࣋͞ΕΔ w ΦϑϥΠϯͷॲཧ͍͍ײ͡ʹͬͯ͘ΕΔʢΒ͍͠ʣ
ͳͥ'JSFCBTF͔
ͳͥ'JSFCBTFͳͷ͔ w J04"OESPJEͰखܰʹ͏͜ͱ͕Ͱ͖ΔͷΛ ୳ͯͨ͠ w ಥવͷ1BSTFDPNऴྃͷ͓Βͤ w ͪΐͬͱ͏͚ͩͳΒֶशίετ͕ͯ͘ࡁΉ ͷͷΛɾɾɾ
ͬͯΈΔ
ΞΧϯτొ w IUUQTXXXpSFCBTFDPN
ཧը໘
ཧը໘ Ճ͞Εͨσʔλ͕ ͜͜ʹදࣔ͞Ε͍ͯ͘
νϟοτΞϓϦΛ ࡞ͬͯΈΔ
None
4%,ͷಋೖ
$PDPB1PET
pod 'Firebase'
ॳظઃఆˍಡΈॻ͖
ॳظઃఆ firebaseRef = Firebase(url:"https:// kanmoba.firebaseio.com/chat/message")
σʔλͷॻ͖ࠐΈ let messageData = ["name":nameTextField.text!, "message": messageTextField.text!] firebaseRef.childByAutoId().setValue(messageData) /4%JDUJPOBSZͰॻ͖ࠐΉσʔλΛ४උ *%ΛϥϯμϜͰੜ͢Δϝιου
σʔλͷॻ͖ࠐΈʢૹ৴ʣ
ཧը໘ͰݟͯΈΔ
σʔλͷಡΈग़͠ firebaseRef.observeEventType(.ChildAdded, withBlock: { snapshot in if let name =
snapshot.value.objectForKey("name") as? String, message = snapshot.value.objectForKey("message") as? String { self.textView.text = "\(self.textView.text)\n\(name) : \(message)" } }) ࢹ͢ΔΠϕϯτΛొ ࢠ͕Ճ͞Εͨͱ͖Λࢹ͢Δ LFZΛࢦఆͯ͠ΛಘΔ
σϞ
None
͘Β͍Ͱ Ͱ͖ͯ͠·ͬͨͷͰ
"OESPJEɾɾɾ
4%,
(SBEMF
HSBEMFCVMJE dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.firebase:firebase-client-android:2.5.2+' }
HSBEMFCVMJE packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE-FIREBASE.txt' exclude 'META-INF/NOTICE' }
ॳظઃఆˍಡΈॻ͖
ͦͷલʹ1FSNJTTJPO <uses-permission android:name="android.permission.INTERNET" />
ॳظઃఆ Firebase.setAndroidContext(this); firebaseRef = new Firebase("https://kanmoba.firebaseio.com/ chat/message");
σʔλͷॻ͖ࠐΈ HashMap<String, String> post = ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹnew HashMap<String, String>(); post.put("name", nameEditText.getText().toString());
post.put("message", messageEditText.getText().toString()); firebaseRef.push().setValue(post) DIJME#Z"VUP*Eϝιου͕ ແ͔ͬͨɾɾɾ
σʔλͷಡΈग़͠ firebaseRef.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String
s) { HashMap hash = (HashMap)dataSnapshot.getValue(); textView.setText(textView.getText() + ɹɹɹɹɹɹɹɹɹɹ ɹɹɹɹ"\n" + hash.get("name") + " : " + ɹɹɹɹɹɹɹɹɹɹɹɹɹɹ hash.get("message")); } } ϦεφʔΛొ
σϞ
None
ͦͷଞؾʹͳΔͱ͜ΖΛ
όΠφϦʁ w #"4&Τϯίʔυ͢Ε0,
Ձ֨
ηΩϡϦςΟ w ʮ3VMFTʯΛઃఆ͢Δ͜ͱͰΞΫηε੍ݶ͕Ͱ͖Δ
σʔλͷαΠζΛ੍ݶ
ϩάΠϯ͍ͯ͠ΔਓͷΈڐՄ
ؾʹͳΔ͜ͱ w σʔλ͕૿͑ͨ࣌ʹ͕͘ͳΒͳ͍͔ʁ w 'JSFCBTFʹ164)৴ػೳ͕ແ͍ w 1FSTFΛϗεςΟϯάͨ͠ํ͕ͬͺΓྑ͍ʁ w Φεεϝͷ#BB4͕Γ͍ͨ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠