MAGNUS HYTTSTEN: Which camera are you looking into?
DAVID EAST: This one.
MAGNUS HYTTSTEN: Ooh!
DAVID EAST: Magnus, how do you say question time in Swedish?
MAGNUS HYTTSTEN: [SPEAKING SWEDISH]
SPEAKER: Ask Firebase 008.
Scene one, take one.
Mark.
DAVID EAST: What's up everybody?
Welcome to a brand new episode of #AskFirebase,
and it's a great one, because we have Magnus on the team.
And fun fact about Magnus is that back in 1990, he
won the silver medal in disco dancing in Sweden.
MAGNUS HYTTSTEN: Ooh!
And a fun fact about David is that for two straight years,
he had to sit and program in the ancient programming
language, Ada.
DAVID EAST: #Truestory.
We have lots of great questions this week
from Twitter, Stack Overflow, YouTube,
and what are we waiting for?
Just dive right in.
MAGNUS HYTTSTEN: Sure.
It's question time.
DAVID EAST: So this first question
comes from David on Twitter.
Great name, David.
But David asks, when will you support Angular Universal?
MAGNUS HYTTSTEN: Right, Dave, so I know Angular,
but what's Angular Universal?
DAVID EAST: For those of you who don't know,
Angular Universal is a tool that allows you to do server ending
with the Angular framework.
And it's really great if you're trying
to get really fast first peak times with your apps.
Right now, we currently do not support that
with the AngularFire 2 framework, which
is a library I'm working on.
But that is only because we're working on shoring that up
with some of the other Firebase features like Firebase Storage,
and also getting it up to date with the new release
candidate with Angular.
But once we get a lot of that smoothed out,
we're going to work with the people on the Universal team
to get that working together.
So just sit tight, David, and just watch the repo
at github.com/angular/angularfire2.
Great question.
MAGNUS HYTTSTEN: It's question time.
So the next question is from [? Burkay ?] from Twitter,
and he is asking, is it necessary to remove listeners
from the database?
And [? Burkay, ?] it absolutely is.
Your activity or your fragment that's
using the database reference, its lifetime may expire.
And in that case, that listener will
be dangling in the memory of the Android device,
and that's very, very bad.
So you must absolutely make sure to remove
all of those listeners when your activity or fragment goes out
of scope.
DAVID EAST: And you can use the activity or fragment
lifecycle to manage these.
So on start methods, or on pause methods,
too, create a listener, but also remove it when you've left.
So that's something really good to do.
MAGNUS HYTTSTEN: Great question, [? Burkay. ?]
And we've come to another question.
DAVID EAST: So this next question
comes from Adam on Twitter.
And Adam asks, are you going to update AngularFire, and then
re-record the screencasts?
MAGNUS HYTTSTEN: You didn't re-record the screencasts?
DAVID EAST: Yeah, I did.
And we actually updated AngularFire
to the brand new Firebase 3.0 SDK, and then just last week,
dropped the brand new screencast.
So if you want to check that out,
the link is in the description.
Great question, Adam.
MAGNUS HYTTSTEN: Have you done this one?
DAVID EAST: Hey Magnus, let's answer a question.
MAGNUS HYTTSTEN: Sure.
The next question is from Pier, and he's asking,
what is the best way to manage the cache in the real time
database?
And the long answer, Pier, is you don't.
Because the cache is maintained by the real time
database behind the curtains, and we
don't want to expose that API so that apps can
depend on the cache in any way.
All of that stuff is done automatically by the Firebase
real time database.
There is no need to access that cache.
But a really solid question.
We've had it before.
It's question time!
DAVID EAST: So this next question
comes from Danielle on Twitter.
And Danielle asks, is there a way
to get a list of users in my app?
MAGNUS HYTTSTEN: Hold on.
>From the authentication API, or the realtime database?
DAVID EAST: Actually, you would use both.
So if you go to the Firebase console,
and you go to the Authentication tab,
you'll see a list of your users from your app.
But if you want to get them programmatically,
you'll need to save them as they create their accounts
to the realtime database.
And if you want to make sure that data is secure,
you can just write security rules
to match against their UIDs.
So that is a great question, Danielle.
MAGNUS HYTTSTEN: I've done that.
DAVID EAST: Yeah?
MAGNUS HYTTSTEN: Yeah.
DAVID EAST: Was it fun?
MAGNUS HYTTSTEN: It works.
DAVID EAST: Firebase.
It works.
Can we start filming this in 3D?
Let's dive into the next question.
MAGNUS HYTTSTEN: Absolutely.
The next question is from Mian, and Mian is asking,
can I get the storage size of a document for the duration
of the video file, or the number of downloads
for an entity stored in Firebase storage?
And Mian, yes you can.
There are a couple of things to do this.
First of all, there is metadata stored together
with all of the things stored in Firebase Storage.
So the size of the file you can get
using standard metadata fields.
Then you can also create custom metadata fields, fields
that you actually populate.
So when a user's uploading a video, for example,
you could set the duration of that video
as a custom metadata field.
DAVID EAST: Yeah, but what about the number of downloads?
MAGNUS HYTTSTEN: That's right the number of downloads.
Same thing as for the duration.
You can use a custom metadata field
that you populate when the thing gets
uploaded to Firebase Storage.
Or better yet, perhaps, in certain scenarios,
you can store that data into Firebase realtime database.
DAVID EAST: And what's great about using the time database
and storage together is that they use a similar file path
data structure where you could say, /file/filename,
and then map that to a path in your realtime database,
and then just use similar security rules in both Storage
and Realtime Database to keep that data secure.
MAGNUS HYTTSTEN: Thank you, Mian.
DAVID EAST: Yeah, really good question.
MAGNUS HYTTSTEN: That simplifies a lot.
DAVID EAST: Oh, yeah.
I love security.
Firebase, it works.
So Magnus, last week we had Doug on,
and we answered all these questions from AnDevCon.
He told me you were there, so what were you up to?
MAGNUS HYTTSTEN (SINGING): If you want to code,
then you should code.
Code.
Get up on the floor.
Firebase!
That's right, I was there!
I interviewed a lot of Firebase experts.
DAVID EAST: Did you interview Frank?
MAGNUS HYTTSTEN: Yeah.
DAVID EAST: But did you interview Mike?
MAGNUS HYTTSTEN: Sure.
DAVID EAST: But did you interview Sarah?
MAGNUS HYTTSTEN: Absolutely.
DAVID EAST: Timothy?
MAGNUS HYTTSTEN: Yeah, Timothy's great.
DAVID EAST: Jennifer?
MAGNUS HYTTSTEN: Of course.
DAVID EAST: Doug?
MAGNUS HYTTSTEN: Absolutely.
DAVID EAST: Frank?
MAGNUS HYTTSTEN: Sure.
DAVID EAST: Sam?
MAGNUS HYTTSTEN: Yeah.
So if you want to see more Firebase content,
you should check those interviews out
for the inside story.
DAVID EAST: So Magnus, thank you so much for coming on.
MAGNUS HYTTSTEN: Thanks for having me.
DAVID EAST: And if you like this video,
make sure to like and subscribe.
And if you want to see his interviews with the Firebase
team, just make sure to check out
the link in the description.
And we will see you on the next episode of #AskFirebase.
MAGNUS HYTTSTEN: Question, next question.
Next-- Next question.
Go like this, like we're dancing.
Next question!