SPEAKER 1: Ask Firebase 206, take two.
DAVID EAST: What's up, everybody?
Welcome to a brand new episode of #AskFirebase.
And we have a special one this week.
Coding Doug is here with us.
And fun fact about Doug is that he
has better than average vision in only one eye.
DOUG STEVENSON: And fun fact about Dave is that--
DAVID EAST: Is that my diary?
DOUG STEVENSON: --he wanted to name his first child Kanye.
DAVID EAST: Kayne East.
But anyways, we have a great show for you today.
We got lots of questions from AnDevCon, so let's dive in.
Oh, there's no gum here.
DOUG STEVENSON: Is this your computer?
DAVID EAST: Yeah.
Really?
DOUG STEVENSON: First up, we have a question
from Jim at AnDevCon.
Let's check it out.
JIM: My question for Firebase is this.
We've got all these new features.
Feels like Christmas.
I'd like to know what's for Christmas next year?
What can you tell me about Firebase's plans
for the future?
DOUG STEVENSON: This is a difficult question
to answer because at Google, we usually
don't talk about the future.
We don't make promises.
And we don't want to be misleading in any way.
I would love to tell you more, but I can't.
I will tell you this, that one of the hallmarks
of the Firebase product is its ability for all of its features
to work well together.
And we feel like we could do that
even better than we do now.
For example, analytics works well
with a lot of different features,
and we would like that to be even more than it is now.
There's been a lot of demand for server-side hosted logic
which is very crucial for a lot of apps
to move logic from their app to the server.
We're looking at ways to get that done
in a cost-effective and flexible way.
So you can look for those things.
DAVID EAST: I haven't really had my one-on-one with Santa yet,
so--
DOUG STEVENSON: Have you been naughty?
DAVID EAST: Let's cut that part.
So let's check out our next question from Gary.
GARY: I'd like to ask Firebase how would I
take an existing SQLite database that
is relational and port that to Firebase storage services?
DAVID EAST: That is a great question, Gary, and one
that we get quite often.
So there's no straightforward way of doing it.
They are two totally different types of databases.
But there are a couple tricks that you should know.
So if you're going to start out with SQL,
you usually work with tables.
And with NoSQL, there's no tables.
There's no foreign keys.
There's none of that.
But what you can do is take these tables
and treat them as top level nodes in your NoSQL database.
Anywhere where you have a foreign key,
you can use the shared key concept
in NoSQL, which pretty much means that these keys
that you're using in your SQL database,
you tend to just borrow them on the NoSQL side.
So you make sure that each one of your nodes,
when it needs to relate to something, just matches up.
So like I said, there's no straightforward way
of doing it.
But if you follow some of these practices,
it does make your life a lot easier.
Like this?
BOTH: Next question.
BEN: I'd like to ask Firebase how to send notifications
based on app events?
For example, if a user logs out of our app
and we want to get them back, is it
possible to send them a notification?
DOUG STEVENSON: Thanks for the question, Ben.
And by the way, I remember you and your team
from the Hackathon.
It was a ton of fun.
To your question about sending notifications
to users who have logged out.
You can't do that with Firebase notifications,
but you can do that with Firebase Cloud Messaging.
It just requires that you have the server-side component
to your app.
And on your server-side logic, you can respond to a log
out, then schedule a message to be sent later on.
So you can't do this on the client side only right now.
But if you do have your own server-side that
can make that logic, you can do it that way.
DAVID EAST: And on the server, there's
SDKs for the real time database.
So you can actually monitor the things that happen in your app.
So you can set up a queuing system.
So when something happens, you can do something
like send that push notification or send a payment or really
whatever you want to do.
So this next question comes from Lucy.
LUCY: I'd like to ask Firebase, do
you make it easy to include photos
and video in mobile apps?
And do you allow permission settings
for who can read and write the photos and videos?
DAVID EAST: That is a great question, Lucy.
And by the way, thank you so much for participating
in the Hackathon.
So do we make it easy to include photos and videos
and set user permissions on them?
Yeah, we do.
Firebase storage is the perfect solution for this.
So with Firebase storage, all you do
is include the SDK in your app.
And then when the user selects a photo, a video-- really,
any file-- you can upload that to Firebase storage
without any need for a server.
And as far as authenticating users
and protecting their data?
Well, when you integrate with Firebase authentication,
you can set security rules that secure those
files to their proper owners.
And that is all customized by you in the Firebase console.
DOUG STEVENSON: So David, just how many photos
could you store in Firebase storage?
DAVID EAST: 1 million photos.
But seriously, probably a lot more than that.
BOTH: Next question.
SEAN: I'd like to ask Firebase how your notifications differ
from doing notifications through APNS on Apple, or iOS,
and how they differ from Google Cloud Messaging.
DOUG STEVENSON: Great question, Sean.
So turns out that Google Cloud Messaging was actually
re-branded to Firebase Cloud Messaging.
And as part of that re-branding, there's
now more things that it can do than GCM used to be able to do.
So you can still send messages to Android devices,
and you can send messages to iOS devices,
and you can send messages to web clients as well.
So you can do all that through FCM.
But in your specific case, you asked
about APNS, which is what you use to send to iOS devices.
So it turns out that FCM uses APNS behind the scenes
to send its notifications.
So when you're using FCM, you're actually
using APNS in the background.
You don't have to worry about all those details.
Is there another question?
DAVID EAST: Sure is.
STEVEN: I'd like to add Firebase to explain good use
cases for Firebase with the Internet of Things,
including specific examples in both practice and code.
DAVID EAST: So that is a great question, Steven.
And a lot of people are using the real time
database for their IoT needs.
And you can actually use the real time database
SDK on an Arduino.
So it's a really nice fit there.
DOUG STEVENSON: Yep.
And it turns out there's code samples, too.
So if you go to GitHub, you can check out a project there
and see how it's done.
So the links are right here.
DAVID EAST: Right here.
DOUG STEVENSON: Oh, right here.
Use the links right here to see how it's done.
DAVID EAST: So that's all the questions for this week.
Thank you all so much for sending them in.
And if you have any more questions,
make sure to send them in to us on YouTube, Twitter, Stack
Overflow.
Just use the hashtag #AskFirebase
and we will get to them.
And if you're interested in getting started with Firebase
and Android, check out this guy's screen-cast right here
on our YouTube channel.
DOUG STEVENSON: And if you'd like
to find out more about David East,
you can read David East's diary, going online right now.
[SLAM]
[MUSIC PLAYING]