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
43
Firebaseを使ってみた
関西モバイルアプリ研究会 #11 資料
Katsuya Kato
February 24, 2016
Tweet
Share
More Decks by Katsuya Kato
See All by Katsuya Kato
複業メンバーと共に創るカウシェ
katsuyax
0
610
AndroidThingsとFirebaseで始めるホームセキュリティ / Android Things Home Security
katsuyax
2
5k
WWDCでこの先生きのこるには / WWDC2017
katsuyax
0
95
watchOS3の新機能 / watchos3
katsuyax
0
91
iPhone(iOS)のアプリ内課金 / in app purchase
katsuyax
0
100
Other Decks in Technology
See All in Technology
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
MLOps の現場から
asei
6
630
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
podman_update_2024-12
orimanabu
1
260
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
240
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
0
150
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Speed Design
sergeychernyshev
25
670
Building Applications with DynamoDB
mza
91
6.1k
The Invisible Side of Design
smashingmag
298
50k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Adopting Sorbet at Scale
ufuk
73
9.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
BBQ
matthewcrist
85
9.4k
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͕Γ͍ͨ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠