July 11 2012: Android Developer Office Hours

Uploaded by androiddevelopers on 11.07.2012

>>Joe Malin: Hello and welcome once again to Android Developer Office Hours. I'm your
moderator, Joe Malin. With me today from Android Developer Relations are Reto Meier, world
famous author, and next to me Trevor Johns.
>>Trevor Johns: Hello.
>>Joe: Sorry. And also three gentlemen from engineering. From your right to left we have,
go ahead.
>>Chet Haase: I don't know where we're supposed to start. I'm Chet. I work on the UI Toolkit
Team on graphics and animation and stuff.
>>Romain Guy: and I'm Romain. I also work on the UI Toolkit Team on graphics and animations.
>>Xavier Ducrohet: I work on Developer Tools and SDK.
>>Joe: Thank you. Well let's get right to it. We have some questions in Moderator that
we'll start repeating and give you some answers if we can.
First one. Using fragments in an application that reorders them visually in portrait and
landscape. Is there a best policy to avoid java dot lang dot illegalstateexception or
cursive entry to execute pending transaction after multiple rotations in a short interval?
>>Trevor: [laughs] That's a good questions actually. I'm not sure. Uh, do any of you
up here know? No. OK. [laughs] Um, yeah, honestly I've never gotten that error. So I'm not quite
sure or, I mean, I think the problem here is. I mean, well, you're probably, you're,
uh, just trying to think. It, it. Hm. [laughs] I think the important thing would be to make
sure that you're not performing fragment transactions right during the rotation. So, if there's
some way that you could avoid that, I'd probably wanna see your code to see what exactly you're
doing. Most of the time, this shouldn't happen. So I'm really curious what in your code you're
doing. If you happen to be watching live, feel free to hop on the air via our Hangout.
And we'd love to talk with you a bit more and figure out what exactly you're doing.
But I think without seeing your code, none of us have a good answer off the top of our
>>Joe: Right. I would agree with that. Based on what everybody has said so far it's probably
best if you do something like post part of your code to stack overflow so that we can
see what's going on. There may be another reason that this is happening. You can't,
I wouldn't just offhand assume that the problem is because of a change in orientation. So
go ahead and post something to stack overflow and we'll take a look at it.
Well, let's move on. We have a link here that says, launcher icons should use a distinct
silhouette. If this is desired, its' very difficult to sell the idea to PMs and designers.
As long as Google apps uses squares with rounded corners. Any plans to change these?
>>Trevor: [laughs]
>>Romain: Well, what apps do use rounded corners? 'Cause I can think of only G plus. All the
standards apps that we ship like Google Playstore, Gmail, they use the silhouette icon.
>>Trevor: Yep. Maps as well. Google plus is pretty much the only app I can think of as
well that uses the rounded rectangle. And in that case that's essentially part of their
logo. So. Yeah.
>>Joe: I can comment that this may be that a confusion about what's in the design guide
versus what we use. As I remember the design guide has an example in which there's a sort
of three dimensional aspect to the icon with a dropped shadow. And we're not using that
right now. So I would say that you should use something that is distinct, that has a
distinct background so that it'll appear correctly regardless of what the device background is.
Other than that, I, we probably have to look more into this.
>>Trevor: Yeah, I mean, generally speaking the goal should be to try and make your icons
match the system icons. I'll also add one other thing. Some device manufactures do change
the default icon themes. So make sure you're actually looking at the icon theme as they're
distributed with, the stock version of Android. So, a good way to do it is just to go and
download the emulator and take a look at what the icons look like there. Just so you're
not confused by any of the theming that gets applied by boolean modifications.
>>Joe: Yes. That's a good point. OK. Next question. Both Dr. Sandler and the Jellybean
Overview say you can add up to three notification actions, but the API Overview says you can
add up to two. Which one is correct?
Actually I looked into this just before we started today and the answer is, three. You
can add up to three icons with text and intense, that will display when you display the notification.
>>Chet: Yeah, I would definitely trust Dr. Sandler 'cause he has a PhD.
>>Joe: Right. Well, I'm not sure that I trust somebody just because they have a PhD. But
in addition Dr. Sandler is the person who actually developed this feature. So I would
say that if he's mistaken, we have bigger problems. So yeah, the answer is three.
>> male panelist: Yeah. That sounds like a doc bug we should fix.
>>Joe: Yeah, I'll have to look into that. The API Overview is basically something that
says here's what's new in Android 4.1. I don't think we're saying in anything about either
ICS or Jellybean in the API guide itself yet. You know, it happens that I work on that.
So I'll go back in and take a look at that as well.
>>Trevor: We have a question from Ed Burnett in the Hangout. OK. Go ahead, Ed.
I think you muted it.
>>Joe: Maybe muted
>>Trevor: Or I've muted it. Let's try again.
>>Ed: Can you hear me now?
>>Trevor: Yeah.
>>Joe: Mm-hm.
>>Ed: OK, so I have a program which uses JNI. And, you know it works fine on Gingerbread,
Honeycomb and Ice Cream Sandwich. But on Jellybean I get an error that I put in the Moderator.
Says "attempt to use stale local reference." And I'd like your advice on how to debug that.
>>Trevor: Alright, sorry. So what exactly, so what are you doing when you get this error,
one more time?
>>Ed: I'm making a call to a native function.
>>Trevor: Humm. Um. So. Ed, does it occur all the time or is it only under certain conditions?
>>Ed: It occurs all the time. On Jellybean.
>>Trevor: Only on Jellybean? Um, that's interesting. [laughs] Unfortunately I don't have too much
experience using the NDK myself. Most of the work I do is you know, using, is entirely
in the Java language. So, I can't, I'm not sure that I'm probably the best person to
ask. But I'm not sure we have any NDK experts with us right now who could actually answer
>>Romain: Actually, this kind of error looks like what happens when you, goes from JNI
codes or from native codes you can grab references to the data that is on the data heap. And
if you don't do it properly for instance, if you grab a reference and you don't release
it, you might run into that kind of issues. I know that we had a bunch of applications
that were not using JNI properly, so there's this feature that you can use to check JNI.
I don't know how to enable it. I think it's in Developer Settings or maybe the [indistinct]
option. But it definitely sounds like you're trying to access data improperly. Maybe you
kept reference on the native side longer than you should have. But it's hard to say without
seeing code or anything like that.
>>Ed: That's what I figured and I did enable "check JNI". Uh, so, it didn't really any
extra information.
>>Romain: So if you can post the question somewhere on stack overflow, or firebug, maybe
we can route that to the data guys. And they might be able to tell you, if you're doing
something wrong or maybe there's a bug. But I know that we have tons of JNI code in the
platform and we have not seen this error, so and I don't believe we have changed many
things with JNI. So yeah, show us your code and we'll try to figure it out.
>>Ed: OK.
>>Joe: OK. Thank you, Romain. Our next question is "What is the best way to play short endgame
sounds. Soundpool crashes on dual core phones. Media player has 200 millisecond plus delays.
Open SL requires SPK9+. That leaves Audio Track. Are there any examples for this at
API with static sounds?"
>>Trevor: Alright, I can take that one. First off, a bit of a clarification. Soundpool does
not crash on all dual core phones. It crashes on a subset of dual core phones, which are
running Gingerbread. So not all dual core phones running Gingerbread. Just some of them.
Unfortunately this is a bug in the way Gingerbread was ported to run on dual core devices. Unfortunately
there's not really a good solution I can recommend. Unfortunately Audio Track will, if you actually
try and use that you'll find it has the exact same bug. So, the work-around here is really,
yeah, the best case is to try and encourage your users to upgrade to Ice Cream Sandwich
on those devices. I believe specifically this is an issue on Samsung Galaxy S2 devices.
And unfortunately upgrading to Ice cream Sandwich on those I'm told does require updating UPA
USB cable which also makes it a bit difficult for them to actually update. But if they're
on Gingerbread, probably the, if you do insist on trying to get this to work, pretty much
the only option available to you is to write your own mixer as a native library. Which
admittedly is quite a bit of work. So, most likely on those devices, if you're, if you
don't feel confident or you don't have time to go and do that level of work, would be
to go and detect when you're on those, that specific subset of devices and display dialog
saying "unfortunately this app is not compatible with your device, please contact the manufacturer
regarding any former updates." Unfortunately that's really the best answer we can give
>>Joe: OK
>>Reto: OK. We have another question on the Hangout from Pieter.
>>Joe: Great.
>>Reto: about fragments.
>>Joe: Fire away.
>>Joe: Hello, can you hear us.
>>[Pedro]: So, are you hearing me OK?
>>Trevor: Yes.
>>Joe: Mm-hmm.
>>[Pedro]: I'm having a little, jumps, OK. So I have an application that has like a dashboard.
With some buttons that have a lot of information. So the
UI is kind of complicated. The fragment that kept the UI logic and kept it really tight.
So each time the application rotates, in portrait it has four buttons. But in landscape it only
presents three for each screen. So each time I rotate, I have to remove the fragments and
re-add them. So the problem that I'm having is that if I rotate really quickly, from portrait
to landscape, and all that, [ inaudible] crash, that I actually, because I read in the documentation
that the removal of fragments its operation. So, I didn't, I tried to execute that transaction
to be sure that all the pinging transactions of adding or removing fragments are done.
But the [inaudible], means so little time. So I don't know what the best policy, you
have have cross that problem already, better. So any suggestion is welcome.
>>Trevor: OK. Do one of you have a good suggestion for how to handle this? [laughs] No? Alright.
Yeah, I think probably we need to go and actually run this by somebody else on our team to have
them take a detailed look at your code. If you wanna go ahead and post a code snippet
of the code that handles your fragment transaction, onto stack overflow, and then just post it
as a comment on the G plus post, we can go and take a look at that after the show and
try and get your answer. Yeah, unfortunately nobody here on the set right now knows the
answer but I'm sure we can find one for you.
>>Pieter: OK. Thank you.
>>Trevor: you're welcome.
>>Joe: Thank you. OK, let's go back to Moderator unless we've got other live questions? Nope.
Go back to Moderator. "Is there a way to integrate an app into the new radial menu introduced
for Google Now?"
>>Reto: No.
>>Trevor: [laughs] At least not without modifying the source code for the short system. But
as an app developer, no.
>>Joe: OK. Next question I have is "Jellybean boasts that view stub is remotable. Does this
mean that a non-remotable view can be lazy inflated into this placeholder?"
>>Reto: No.
>>Trevor: [laughs] I mean to go into a bit more detail, you know remote views have a
bit of restriction as to what they can do. And so just thinking about this for a second,
if you could place a regular view inside of a remotable view stub, that's not remotable,
you could probably do a lot of things that you shouldn't be able to do inside a remote
feeder. So just from that standpoint it doesn't make sense to be able to do that.
>>Joe: OK. Thank you.
>>male off mic : Loophole.
>>Joe: Next question. [laughs] Sorry, that loophole is closed.
Next question from Moderator. "Expandable notifications currently have a fairly large
discoverability issue. Is there a way to make them, make it more visible that the notification
is expandable? And is it a way to expand it while using the phone one handed? That is,
not using multi touch?"
>>Chet: Actually, don't they auto expand when they become the top notification? That's part
of the discoverability.
>>Trevor: Right. So yes. The system does automatically expand them. But the ones that are closed,
I mean, if you really wanted to go and give somebody a visual cue you could go and add
some small text there saying "Drag to expand." I wouldn't recommend doing that because none
of the system apps do it which means your app's gonna feel out of place. And generally
speaking you should try and make your apps blend in with the style that's provided by
the system apps. So, given that none of our apps actually go and provide any additional
clues behind, aside from what the notification floor already does I wouldn't do anything
extra. I'm also not aware of any way to go and manually expand them without using multitouch.
But again, the system will automatically expand them under certain circumstances.
>>Joe: thank you.
>>Trevor: And of course you can always tap on them, too, if you want to actually open
>>Joe: Right. Yeah. I would say that probably the best thing is to assume that, in most
cases, the user's gonna wanna tap on the notification and actually go to the application that was
responsible for issuing it to begin with. That's what users expect. There's certainly
a lot of information now that became from looking at notifications. In the current releases.
But still we wanna encourage users to, we wanna encourage you to have your users go
back to the application to get more information. That's the best way of handling it with an
app. I think.
Next question. "Regarding bitmap dot recycle. Recently I have noticed heap memory corruption
error occurs. Is it true that in ICS that we should not be calling bitmap dot recycle?
I saw this entry but no other documentation." And then there's a link to stack overflow.
>>Romain: No, it's not true that you should not call bitmap dot recycle. you can call
it. But actually as of Honeycomb, so Android 3.0, calling bitmap dot recycle will not do
much. It will simply set an internal byte rate to null on the dalvik side. So it's gonna
help a little bit to reclaim the memory faster as soon as the GC can do it. But it's not
gonna make a big difference. So if you're running into issues because of bitmap dot
recycle you can avoid calling it. It's not going to do anything bad to your application.
But it's perfectly safe to call it. Now, I don't know why you're wanting it to crash
when calling bitmap dot recycle. I'm sure there was some sort of a bug in the ICS. And
if you have a repro case or you can Firebug, we'll take a look at it and see what's going
on and make sure that it doesn't happen in Jellybean or future versions of Android.
And I think there was a follow up to the question, asking how you can avoid out of memory errors.
So what we've done in Android 3.0 is we added a new feature in bitmapfactory dot options.
where you can reuse bitmaps. So you already have a bitmap already in memory. You can pass
it to the bitmap factory so it's reused. So we'll reuse the allocated memory. And you
can pre-allocate your bitmaps ahead of time. And reuse them as you go so that you don't,
you don't need more memory when you're on your app.
>>Joe: Thank you, Romain. Next.
>>Reto: There's a couple of questions from people in noisy environments on the hangout.
So I'm going to read them out to you.
>>Joe: Please.
>>Reto: This is from Anush Goral. He says "Is there a way to add the Google Maps API
to the Intel Exit Six Android Emulator? And I don't want to build a system image from
scratch as mentioned in the stack overflow question."
>>Xavier: So you can't really do that yourself anyway. We do plan on doing it at some point.
We just haven't had time yet. But it's high on our priority list.
>>Reto: Excellent. Thank you. And I have another question from, we can scroll up here. From
Mark, who says "On Windows XP", and he apologizes for that knowingly, "Is it possible to run
NTP mode while USB debugging is turned on, when the next server running Android running
>>Romain: Can you repeat the question?
>>Reto: I can repeat the question. Is it possible to run NTP mode. Uh. Oops.
>>Joe: NTP.
>>Romain: So NTP at the same time as you're doing debugging?
>>Reto: that is correct.
>>Romain: It should work 'cause that's what happens every time I plug in my device on
my desk computer.
>>Xavier: Windows XP.
>>Romain: on Windows XP? Uh, I don't, do you know about? Sure.
>>Reto: I've never tried it on XP either. So. I know it works on the Mac, but.
>>Romain: Yeah, it works on the Mac. It works on Linux, I presume
>>Joe: it works on Linux, You just need to install some stuff.
>>Romain: OK. So it works on the Linux, works on Mac, don't know about Windows XP. We should
try it. Do we have a Windows XP Machine?
>>Xavier: [inaudible]
>>Romain: OK.
>>Reto: We should be able to dig one up somewhere.
>>Joe: Any others? OK. Let's go back to Moderator. "How can I expand the collapse notification
from Jellybean in the emulator? Is there a simpler way other than tethering the device
to the emulator to send those multitouch gestures?"
>>Xavier: No. there's no way right now to emulate multitouch without that.
>>Chet: Two mice?
>>Xavier: Two mice won't work on all OS. I think it works on some, but not all of them.
Yeah, we don't really have a solution for that right now?
>>Trevor: Can you do multitouch via Monkey?
>>Romain: [inaudible]
>>Xavier: I guess you could.
>>Trevor: Yeah, so you can probably run a script to do it. Um. I can't remember what
the exact commands are off the top of my head, but if you take a look at the documentation
for Monkey Runner on the Android Dev site. You'll see that you can basically send program,
mouse gestures, key events, things like that. And then you can use that to go and write
a little script that generates your multitouch events for you.
>>Joe: OK. Next question. "How can one load data on fragments, not creating them, in a
view pager when changing pages, and avoid destroying the fragments. Like lazy-loading
the fragments data."
>>Trevor: [laughs] Silence. Um.
>>Joe: We've stumped the panel.
>>Trevor: Yeah. Um. That's a good question. I mean there is a [indistinct] then that gets
called when the fragment comes visible, right? So you could go and try and do it there. Just
listen for when your fragment's actually on the screen.
>>Trevor: That's probably the best way to do it. Yeah.
>>Joe: [sighs]
>>Reto: I have a question this time from Trevor Solomon on the Android Developers stream.
And he asks, or he says he's pretty new to Android Development and would like to avoid
using Eclipse, due to the many quirks it has. Strange, I've never heard that before. Instead,
he's learned about IntelliJ. However, version 11 does not have a UI designer. Are there
any third party external tools to help with your UI design. Preferably free or hobbyist
>>Xavier: Not that I know. At least not ones that are really go. IntelliJ 12 will have
a UI designer though. So there is a think a preview version of it. I don't know how
stable it is. But I think you can download it and try it.
>>Chet: They were showing it at IO.
>>Xavier: Yeah, they were showing it. But I don't know if it's completely finished and
polished. It's probably still buggy. I don't know when it's supposed to be released and
>>Chet: You could also not use a designer.
>>Xavier: And you could also not use a designer, yes.
>>Trevor: and it does UI preview. So if you're comfortable editing XML and you should be
because at some level you probably will have to edit some XML, you can at least display
what your changes are, even though you can't drag and drop things around.
>>Joe: OK. Any other comments? At an IO session a new version of the support library was discussed.
That would have a support for the action bar. Is there a general estimate when this will
be released?
>>Trevor: I can take that one and the answer is, soon. I don't wanna get more specific
than that. But hopefully sometime in the near future.
>>Joe: OK. In the IO session and then there's a link, Reto talks about dynamically adjusting
periodic transfers and batching transfers. I'm wondering how his examples can be applied
to the sync adapter. Like, can I get it to piggyback on a time sensitive transfer?
Reto, do you wanna answer that one?
>>Reto: Uh. Let's see, if I'm very lucky this camera will be pointing at me. No. let me
try again. Point it at the camera.
>>Chet: I can always tell the audience what you look like.
>>Reto: That could work.
>>Chet: Wooooo. Wow was that fancy.
>>Reto: That was fancy, and would have worked. To go to the site, I don't really have the
answer. At least not a good one. I'm not aware of a way that you can piggy back on top of
sync adapter. So you can trigger the sync adapter to do a refresh if I'm not mistaken.
So you would probably be wanting to do that. At the same time as any other, as a way to
bundle those sync adapter updates with any time scan sort of transfers that you wanna
do within your application. But I'm not sure of away you can do it the other way around.
So listen for a sync adapter update and piggy back the rest of your updates that way. Does
anyone else have any insight there?
>>Joe: It's kind of, my feeling is that it's kind of at cross purposes to the whole idea
of sync adapter. Because sync adapter is supposed to control a lot of that stuff for you for
things where you don't have something that's really that time sensitive. On sync adapters,
in a certain extent, takes over all of the stuff that you normally have to write to figure
out when to do something. Check to see if there's a connectivity, etcetera. And it's
for things that you are willing to allow on the background. On a periodic basis. But not
necessarily immediately. And unfortunately if you've got something that's really time
sensitive, you probably have to step in and do the handling of the transfer yourself.
>>Reto: Quick follow up as well from Trevor who says "Thank you for the answer." For what
it's worth, he's comfortable with XML but that doesn't necessarily mean that it's fun
>>Trevor: Oh no. I totally agree. [laughs]
>>Reto: He'd also like to point out that it'd be cool if Google released some sort of UI
toolkit to make it easier.
>>Xavier: What kind of toolkit is he talking about?
>>Reto: That's a good question. I will ask him and get back to you.
>>Joe: OK. Great. Super. Um, Let's move on. Why doesn't Listview support drag and drop
reordering of its items. Can you consider adding support for this in the support library?
All the current third party implementations feel very janky and subpar.
>>Romain: There is currently no plan to add it to add this feature to the support library
or in listview. Mostly because it's not a feature that many apps need. We have an implementation
in our source library that you can use. I think it's the music application. And frankly,
it's not high on the list of priority of things that we have to do. Our engineers are pretty
busy at the moment.
>>Joe: OK. Alright. Next question. "Is it acceptable to wrap SQ like open helpers as
a singleton object as long as the context being used is the application context?"
>>Trevor: So I think that's probably OK. I definitely wouldn't do it with the activity
context, 'cause your activity can get destroyed. But if you use the application context though
you're most likely going to be OK. The only thing that you could run into is if somehow
the application context becomes invalid but your process doesn't get destroyed. Which
shouldn't happen normally. But yeah. That can't happen, right?
>>Romain: I don't think so.
>>Trevor: Yeah. So you're probably OK.
>>Joe: Alright. [pause] "Lock canvas call causing a DQ buffer fail error. Got around
it by introducing a 20 millisecond sleep on resume coming from home launcher screen. Question,
do we need to worry about DQ buffers or is this just a freak OEM error?"
>>Romain: You should never have to worry about DQ buffers. You shouldn't have to know that
it's there. You shouldn't need to understand what it does. So without, I will have to look
more about, at your error and your code to understand what's going on. Let's see, it's
in surface texture, yeah, you don't have code in stack overflow. Oh, there is code in the
stack overflow. So you're doing that on the surface view apparently. Um, yeah, we have
to look into more in details, but it's not something you should have to worry about normally.
It's too buggy. There are bugs.
>>Joe: Great. Thank you Romain.
>>Reto: I've got a follow up from Trevor. In response to what kind of toolkit is he
after. He said "A toolkit is a UI tool that would generate and or modify the XML. Similar
to visual studios, [ indistinct] designer for WPF/similar applications and metro UI
applications in Win Et.
>>Xavier: Well that's exactly what we have in Eclipse. Of course, you don't like Eclipse.
So, I don't know what we can do for you.
>>Trevor: [laughs]
>>Xavier: I mean, our goal is to make it better. More usable. How we're going to get past people
who don't like Eclipse, that's another question and we don't have anything to say at the moment.
>>Joe: OK. "Does the use of listview provide any benefits performance or otherwise over
a single column grid view?"
>>Romain: There would be, slight performance benefits to it because there's, listview is
less work to do. And also listview is much better and hanging things like input fields,
focus, items of different types. Items of different heights. I mean, gridview, really
you should not use gridview if you're doing a single column and that's what listview is
>>Joe: Alright. Good. Excellent.
>>Joe: "This is a more userland question but it drives me nuts." Alright. "I have no clue
what I keep doing, but I get a choice intent Drive or Gmail, when I select Drive, it goes
boom. When I select Gmail it asks me who to mail an email a bug report to. WTF?" Which
I won't translate.
>>Trevor: [laughs] Alright. So that one is, I assume you're on a, doesn't say here but
I assume he's probably using a Galaxy Nexus. Many of the, what you're seeing here most
likely is a debug feature that gets activated when you push volume up, volume down and power
all at the same time. And that's equivalent to running a debug report. But rather than
sending the bug report date off via usb, it creates a file and then sends off a share
intent asking what devices would like to receive it. Which, would likely be Gmail or Drive
and possibly anything else he installed that can handle attachments. So, the short answer,
if it, you know, don't do that. Don't push volume up, volume down, and power at the same
time. If you are using another device, these, the sequence of keys you have to press does
get changed depending on what keys are available on the device, right? I, you know, back in
Galaxy, or in the Nexus 1 day, I think it might have involved the trackball. I can't
remember. But yeah, in, that sequence of keys, unfortunately, is a little bit easy to press.
So you're not the first one who has asked me that. That being said, if you, it's harmless.
It's just a debug thought that gets generated. So you know, if you just hit back, the, no
harm done. If you send it, no harm done. It's just an attachment. Then whoever does receive
it will get to see your system log, so you might not want to send it to random strangers.
>>Joe: right. And it happens to me on the fairly often. It just depends on what your
tolerance level is for that. So.
>>Reto: I have a question from Mauritz Post on the G plus stream. He has a question regarding
lint. Should Lint be able to dish up errors if an application references at android colon
attributes that are introduced after the minimal SDK version?
>>Xavier: So, Lint, I don't think we do any check of that sort at the moment. The issue
is that it's perfectly valid to actually reference some attributes that on higher than your particular
version. It's just that on lower API level, the application will just ignore them. And
application running on a version where, that actually exits, then it would be used. So
at least you should probably put a warning. But then if you actually want to do that,
you would have to have better was of ignoring that warning, there are attributes. But we'll
see what we can do. It's a good idea.
>>Joe: OK. Great. Next question. "There seems to be a bit of overlap between the upcoming
Google Play services library and account manager. Has the latter been, from a practical point
of view, deprecated? If not, can you give any insight on the use cases where one should
be picked over the other?"
>>Trevor: OK. [laughs] So, account manager has not been deprecated. As for the rationale
as to why Google Play services is not using account manager, if I remember correctly there
were some features that they wanted to introduce that weren't compatible with the API service
that account manager exposes. And so because of that they decided to do it as a separate
library. As a application developer, if you're creating your own account provider, I would
definitely use account manager whenever possible. In fact I think we still will be using account
manager even internally just because we have to go and keep track of the Google account
you register on your phone. I think Google Play services just drops that. As a, an API
consumer. If you're writing your own Android app that just needs to go and access an account,
you know, decide, basically you have to look at the API when it's published and determine
which one has the features you need. If account manager does everything you need to do, then
you're fine. If you wanna use the new features to get introduced as part of the Google Play
services, then you know, of course you'll have to use that. It's really just a matter
of what it is you want.
>>Joe: OK. Any other comments?
>>Reto: So I have a question from Chris Hall in the Hangout, who asks "What is the best
way to implement landscape to portrait switching?"
>>Trevor: Rotate your phone? [laughs]
>>Joe: I'm assuming that, well, that's an interesting question because I'm not sure
what he's trying to do.
>>Reto: So I'm gonna ask Chris if he can give us a little bit more data as to what you mean
by implementing landscape to portrait switching. In that, normally this would just happen by
default. So I guess we wanna know what is the specific use case that we're trying to
>>Joe: While we're doing that, let's move to the next question. It should be pretty
easy to answer. "I thought I'd mention this, the API reference docs on developer dot Android
dot com are pretty much unusable on a tablet or phone. I was wondering if this could be
fixed for those of us who are curious about the AP stuff as, API stuff as light reading.
>>Romain: So here's the good news, on Jellybean, we just tried with the standard browser it
works really well.
>>Trevor: Yeah, there is one catch and it is if you're on a phone, I don't think it's
so much a tablet issue but it just a screen size issue. If you are on a phone, the video
part's a bit small compared to how the, the size at which the docs are easily readable.
It's a known bug with the docs. In fact, I filed it the moment the docs launched. So,
it s something that I think we wanna go and address. It just didn't make the cut for the
first release of the site redesign. So we'll probably get there eventually. In the mean
time, sorry about that. I will add also, if somebody feels really adventurous, and wants
to write a Android API viewer that runs as a native app, I'd totally love you for it.
[laughs] All the docs actually that we publish as part of the developer dot Android dot com
site are actually checked into the open source tree. I believe most of them are in framework
space docs html. So if you really wanted you could actually go and extract everything there,
make your own nice pretty doc viewer that runs natively. But if nobody gets around to
that, we'll eventually fix the html site. And I'm not even sure fix is the right word.
We will improve the site to go and have a more responsive layout.
>>Joe: it's a great question. I don't personally, I'm a technical writer for Android developer
relations. And I don't consider reading the API reference necessarily as light reading.
But it's an excellent question and I'll take it back to our team to take a look into more.
As far as I know, all the documentation is in frameworks based docs html. Certainly all
the API reference docs are there.
>>Trevor: Yeah.
>>Joe: and so if you wanted to write, or a doc with a, to handle that, it would be fine.
I can't offhand remember where our existing doclet resides. And, ahhh, so, unfortunately
I can't remember that. But it certainly
>>Trevor: Actually, I will say, the API reference I think. That's actually generated by a Droid
doc, right?
>>Joe: it's generate, well,
>>Trevor: [unintelligible]
>>Joe: it's generated by Droid doc. Which is a bunch of things that include doclet functionality.
>>Trevor: Right. But yeah. So part of the API references are auto generated.
>>Joe: Right.
>>Trevor: So watch out for that.
>>Joe: Yeah. You will have to consider the fact that we auto generate them from the code.
>>Trevor: Yeah. If you do wanna play around with this, just run "make offline SDK docs"
as the target. And that'll run through the whole doc building process and you can play
around with it.
>>Joe: Right. OK?
>>Reto: OK, we have a question from, let me see, who was he? From Joram in the Hangout.
>>Joe: OK.
>>Joram: Yeah, I have a quick question about portrait nomenclature and stuff. I mean, the,
if you proof the word performance in the system, however, if you want to load images while
scrolling there is still some jank. I actually analyzed it with sys trace, and it seems that
process called "image cache" sucks up all the [ indistinct ] cycles and the other thread,
the other process blocks in there. So, why is that exactly, is that a boss problem? Or
it happened on my on the Galaxy Nexus.
>>Romain: What is image cache? What application on what device?
>>Joram: It's a Galaxy Nexus running Jellybean stock. And, basically some frames get dropped
off if you want to try to load an image while scrolling. In the background [inaudible]
>>Romain: In what application?
>>Joram: It happens in all applications. Specifically, with the Google plus set, for example.
>>Romain: Well, so yes. I mean Google plus, we knew there was a fluency issues and people
are working on it to fix them. It's just a problem with the app. There's nothing wrong
with the system or anything. If the app is blocking the, there's nothing we can do about
>>Joram: So, a development rich app. It happens, I mean it happens on YouTube, in my own apps,
on Google plus, every time you try to load an image in the background thread, then it
blocks the directory thread.
>>Romain: No, it won't unless you are blocking the rendering thread by doing something else
or waiting on another thread.
>>Trevor: Yeah, I did some demo of this for Google IO. Yeah, if you're loading all of
your images you know say in the background thread. And you're really absolutely sure
that you're not doing any heavy lifting as part of your UI thread, at least as far as
my eyes could tell there wasn't any jank.
>>Trevor: it's possible there's a common pattern being used that, [laughs] Wow there's some
good noise on the Hangout. It's possible there's a common pattern a developer is using that
just happens to introduce jank frequently. But as far as I can tell I haven't noticed
anything wrong with the system itself but then again, it's entirely possible you're
seeing something we missed. You know, if you wanna, like we say record a video or something
and send that to us. We can always take a look at it. But at least as far as our experience
has been we haven't seen this. I'd love to see some more details as to what you're saying.
>>Joram: I posted the sys trace, sys trace to html. And here you can clearly see that
the process called "image cache" sucks up the CPO cycles and the rendering process doesn't
get the CPO cycle. So it might be a scheduling problem or--
>>Romain: It could be a scheduling problem. It could be many other things. It could be
the, the image cache whatever that is 'cause that's not part of the framework. Maybe reading
something after the file system and the rendering thread for whatever reason is trying to access
the file system as well. So the, one of them is blocked on the other one. I mean there
can be many, many different reasons.
>>Joram: OK
>>Romain: And I don't think there's one explanation for all the issues. But you know, in Jellybean
we've improved performance throughout the system. But we're still working on that. So
we'll definitely look into that and I know that the G plus guys are looking into those
problems already.
>>Joram: OK. Thank you.
>>Joe: yeah, I think a key thing here as far as I can hear is that this image cache process
that he's talking about is not part of the system framework. So it's important to figure
out what exactly that is, where it's coming from. 'Cause if it is something that's been
installed or running for some reason, that could cause problems in the entire system.
Although it's not something that comes with the framework.
>>Reto: OK, we have another Hangout question.
>>Joe: Great.
>>Reto: This one is from Matthew.
>>Joe: OK. Hello Matthew.
>>Reto: I think you muted Matthew.
>>Joe: Matthew are you muted?
[feedback noises]
>>Joe: Hello?
[feedback noises]
>>Joe: No? Yes?
>>Reto: Yeah, if you can unmute yourself.
[feedback noises]
>>Trevor: [laughs]
>>Reto: I don't see on
>>Trevor: Oh wait
>>Matthew: I unmuted it as far as I can tell.
>>Trevor: There you go.
>>Joe: There you go.
>>Matthew: I'm sorry. I had a question on the smart app update. Trying to get it to
work to see what kind of impact it has on the application side. I just updated the Android
manifest updated version, it still downloads the full, you know, three megs of the app.
I'm using the latest Google Play that I can see, it's three, 13 dot7 of Google Play.
>>Trevor: Yeah, so there's no one here from the market team. So I'm not sure if any of
us are gonna know exactly why that might be happening. To my knowledge the smart updates
are just supposed to happen automatically. There's nothing
>>Matthew: [inaudible]
>>Trevor: you need to do as a developer to take advantage of that. Um
>>Chet: [inaudible] version of Monarch that you have right now?
>>Matthew: And then it was, was it gonna impact the application side at all, 'cause you have
ea signed file that they're somewhat pushing bytes into it or something.
>>Trevor: No, it shouldn't make a difference because the signature will get sent along
with it as well. The updated signature.
>>Matthew: OK.
>>Trevor: Of course, you don't wanna go and change your signing signature between releases.
>>Matthew: Right, definitely not.
>>Trevor: 'Cause if you do that Google Play won't accept the update anyway. And even without
smart updates that would get you in trouble. So.
>>Matthew: Right.
>>Trevor: So to my knowledge there's really nothing you have to take advantage of as a
developer. It's possible that for some reason it's been temporarily disabled on your phone.
Or there might be some edge case where it automatically turns itself off. I'm not sure
of the details of how that mechanism works.
>>Matthew: OK.
>>Trevor: It should just work though. So, I wouldn't worry about it too much.
>>Romain: And it's the mechanism we use for our OTS. We use the same smart updates when
we update the whole system. And where the system sign in works just fine.
>>Joe: Great. Hm. OK.
>>Reto: We have another person on the Hangout.
>>Joe: Wow.
>>Reto: It's very dark where Ismael is, but I'm gonna put him on anyway. And, hopefully
we'll at least be able to hear him.
>>Joe: Alright.
>>Reto: Ismael, when you're ready.
[feedback sounds]
>>Reto: Um, nope.
>>Joe: [inaudible]
>>Reto: Doesn't sound good.
>>Joe: There is [inaudible]
>>Reto: [laughs] Indeed. Perhaps we'll go to the next one. A Moderator question.
>>Trevor: Been eaten by a monster.
>>Reto: Eaten by glue. Really.
>>Joe: OK. Next question. "My developer's console is a bit messy. And I need to take
off the unpublished apps. Is there any way to do this?"
>>Trevor: So, it depends on what you mean by unpublished. If the apps have just been
uploaded as drafts and you're doing, say debugging for license verification or enact billing,
something like that. Then there's the delete button. However, once you published your application,
if you later resend it, if you unpublish your application later after it's been published,
there is no longer the option to delete an app and that's by design. So the reason behind
that is because, you know, there could be purchase history associated with the app,
the package name is permanently reserved as well, so if you deleted it you lose the package
name. there's a lot of reasons as to why deleting a previously published APK or a previously
published application is not allowed. That being said, there is a UI redesign happening
for Google Play. For the dev console. So hopefully that'll go and help clean clutter up a bit.
But right now, there's not much you can do to remove those if they've been published.
And if they haven't, you know, check in the details page and you'll find the delete button
at the bottom.
>>Joe: OK. Thank you. This "During this Google IO we heard a lot about the use of cards.
Is there a standard or best way to try to use these?"
>>Trevor: Um, is this, I assume this is referring to the cards in Google Now?
>>Chet: that's the only cards I have. Those apps specifically.
>>Trevor: So inside of Google Now, there's you know, the cards are provided by the Google
search app. So there's really no way to go and create additional ads. There's no API
for example. Now, if you wanted to go and try and emulate the card UI design pattern
within your app, we don't have any published standards on that yet. It's still very new.
I'd just try and you know, take a look at how the app works and emulate it based on
what you see there. It's not a pattern we're necessarily recommending to developers yet.
So, yeah, if you decide you know what goes into your app, you're on the bleeding edge
of things.
>>Romain: And if you want to try to use the cards as a user, you should go to Google Now.
At the bottom there will be a small button that says "Show sample cards" if there's no
cards showing. So you can click on that and Google Now will generate a bunch of cards
so you can get an idea of what they look like and how you can talk with them.
>>Trevor: Oh. Yes. That. Yeah. I didn't think about it from a user point of view. If you
are a user definitely take a look at the sample cards. It'll even tell you some of the ways
it gets triggered. For example the flight status gets triggered when you search for
a flight. Most of the time though I found that they just tend to work properly if you
use Google.
>>Joe: Any other comments? OK. This is also about Google now. "Does Google
now replace the standard search app? And does it search inside third party search interfaces?
What happens when Jellybean reaches devices and you press the search button? Will Google
Now start?"
>>Romain: So in the developer preview of Jellybean that we gave out at the Google IO, you should
go to the settings in Google Now, you can add initial search sources. So by default,
only some of the built in apps will be used as sources for searches. So there will be
Google Music, Google Play, your list of installed apps. But you can also enable search for other
apps so for instance you search an Evernote, Kindle, Spotify, that kind of apps. But you
have to go enable them yourself.
>>Trevor: Yeah. Even the little quick search box had that same requirement. There was a
menu buried somewhere that would let you go and toggle which apps were indexed.
>>Romain: Yeah. But they used to be all enabled by default.
>>Trevor: Ah. Gotcha. OK.
>>Reto: Got a couple of question in Hangout.
>>Joe: Go ahead.
>>Reto: so I'm going to, think I'm going to read them out. There seems to be someone playing
music aggressively.
I'll try and sort that out. In the mean time, Ismael, his question was, let me see if I
can find it here. "Is it possible to use a USSD code in call intent? For example, hash
one two two hash." He's tried to use it in his app but he gets an error USSD connection
problem invalid. NMI code. Does that mean anything to anyone.
>>Trevor: Yeah. So. The USSD codes are carrier specific codes to go and do things. So they
have a very odd format. Now as to why the dialer app isn't accepting them, it, honestly
it sounds like it's either a bug with the dialer or it's possible that they might need
to be encoded in SIM card somewhere to be recognized as valid. But that seems a little
off to me. Without knowing more about the [indistinct] stack, I can't give you a definitive
answer there. Yeah, you could go and search through the source code and see where that
error message is being generated. I mean it sounds like something that should work.
>>Joe: Chet?
>>Chet: Nothing.
>>Trevor: Yeah, I mean the [indistinct] stack is definitely all up there as part of Android
open source. So you know, take a look through the source code. See if you can find where
that error is generated. And that should give you some clues as to why you're getting the
error that you are.
>>Joe: Alright. Did we have anything else hanging out there, Reto?
>>Reto: I'm just gonna check to see whether Simon. Yeah, Simon does wanna ask it. So I'm
gonna put him on now.
>>Joe: Go ahead.
>>Reto: OK. You're up Simon.
>>Joe: Hello Simon.
>>Simon: Hello. [clears throat] Just wanted to ask about STSL certificate authorities
across the [indistinct] system. So, across the tel coms, you know, they change. So mostly
what happens is everything happens, you begin the cell connection and then some devices
just give up because they can't handshake. And the pattern of the [indistinct] that have
a number of different landing URLs and I just fail gracefully until you get to a decent
connection. And the one that seems to fail is Komodo, mostly, across devices. So I just
wondered what the best approach was or if you guys recommend it. A CA to actually assign
>>Trevor: so just to make sure, you're not writing a browser or something big like that.
It's more you could encounter any certificate actually like access an API endpoint right?
So you do control both the application and the server? Correct?
>>Simon: Just making the cell connection to make sure that most [unintelligible] are in
play. And it works like 99 percent of the time. But I do all my work with tel cos. But
eventually one of the tel com releases a device and it's got some, basically just removed
some stuff from the [indistinct ] list and burned it onto the device. And you're left
going, oh, I can't make a connection. So I know I can't avoid it. But it's just a case
of you guys recommend, just go with their sign? Or just or is there a pattern to go
for, you know, a stack, or attempting multiple connections? 'Cause the pattern I go with
is just multiple end points until one works. And then I stick with it until it keeps working.
>>Trevor: I mean, I'll certainly add, you probably can't go wrong with their sign. If
somebody shipped a phone without support for your Verisign, I suspect a lot of websites
would be broken too. So the same goes for you know, GoDaddy or Thought, or any of the
other really big CAs. Now, that being said, we do have an API that'll this is why I was
asking if you controlled both ends. We have an API that will go and let you register additional
CAs within your application. So if you know there is a preferred certificate you'd like
to use, you could use that API call in, say the, explicitly add this to the trust chain.
>>Simon: OK. OK. I'll go looking at that. I've just been racing by that, not looking.
To be honest. It didn't handshake so let's move on to the next one. But yeah. OK, I'll
go look.
>>Trevor: Yeah, and then since the app is, I assume it's either preloaded or distributed
through Google Play, correct?
>>Simon: yeah.
>>Trevor: Yeah. Just as long as the app's coming from a trusted channel you should be
OK there. The thing you wanna make sure is, you know, if a user does manage to, if they're
side loading this app for some reason. Hopefully that's not the case. But. Since you are registering
additional trust routes. If these are just apps from an untrusted source, an attacker
could modify that. Just make sure that however the user is getting the APK is from a trusted
source and there's not tampered with
>>Simon: Yeah. I mean, the other way I did it was to self sign on both ends and then
borrow an encoded cert onto the app itself. But it was just too, it wasn't real enough
basically. And it means that you were permanently in the state of not really trusting the connection.
>>Trevor: Well, self signed cert isn't bad as long as the, both ends, both pairs of that
certificate are under your control. If you control the client, you can use a self-signed
cert. and there's no harm in that. You're subject to the exact same caveat I just mentioned
that you need to make sure that the APK is delivered through a trusted mechanism. I mean
you're only self-signing the cert used to sign your application. So.
>>Simon: Well, yeah I just fall into this kind of crazy elliptical situation with tel
coms where they just say "We gotta go via some paid for rather than a bunch of dudes."
And that stuff.
>>Trevor: Understandable.
>>Joe: OK.
>>Simon: OK so I don’t' feel like I'm doing anything wrong then by going through multiple
landing URLs to get to a decent site.
>>Trevor: I'm not saying that. Honestly, you shouldn't have to. The list of trusted CAs
shouldn't change that dramatically between releases and between phones. There is a canonical
list of trusted CAs that is distributed as part of Android Open Source. And honestly
I'd start with that and that should give you a list of who we say is the trusted CAs. And
of course there's nothing stopping an OEM from modifying that list. But you know, if
you go with the common CAs
>>Joe: Yeah.
>>Trevor: If they start taking those out it's not just going to be your app that fails,
it's going to be the whole web.
>>Simon: Yeah. I mean, not to keep the whole Hangout on that, but I, basically
>>Joe: Right.
>>Simon: That's been the case. You know, your banking would stop working when they take
some out. But it was basically Komodo got taken out. Couple devices. Non-routed. Regular
devices that carriers they shouldn't just go to [indistinct] to over CAs went missing.
Anyway, that's great. Thanks so much.
>>Joe: Thank you.
>>Reto: Yeah, we have a couple of quick questions because we're just about out of time.
>>Joe: OK. Go ahead.
>>Reto: a couple in the ES room and the Hangout. So Mario would like to know "Will there be
more templates for activity creation in the Android developer tools? And will they support
the compatibility library in order to develop consistent apps for Android versions prior
to ICS?"
>>Xavier: Yes. Definitely. Actually the current templates do use the compatibility library.
But they also use the action bar. So since we don't have support for the action bar yet.
I'm looking at you, Trevor.
>>Trevor: Yeah. [laughs]
>>Xavier: But as soon as we have that then we'll definitely use the support library and
we are planning on adding a lot more templates, too.
>>Reto: Excellent. Thank you. And. One more question. So this is a follow up from Chris
Cole who was asking the portrait to landscape question earlier. He says he's writing a note
taking app for Jellybean. And people keep typing, it scrolls my things away. And he's
trying to figure out the best way to initiate the switch to landscape mode for easier typing.
So I think what Chris is trying to do here is manually decide whether the user should
be looking at the app in landscape or portrait mode based on his activities. Sort of, interaction.
>>Trevor: OK. So he basically wants to programmatically switch to landscape.
>>Reto: Yeah. Or what least he's trying to figure out if that is the best case scenario.
Which I would probably hasten to say isn't. Anybody wanna go into more detail?
>>Trevor: So, if I were to, probably the best way to do this. Well I was gonna say you could
go and tell layout inflator that you wanna put a landscape constraint on there. But then
you have the issues like the keyboard and things like that. Yeah, I'm not sure how you
actually go and tell the keyboard you want to be in landscape mode.
>>Romain: You can. I don't really know the exact API but there is a way for the app to
request a configuration change. I don't remember exactly where it is. Only in the [indistinct
] class somewhere which can. Actually a lot of games do that. They request the, the, landscape
rotation. Now, it might be a little confusing for the user 'cause you're holding your develops
in portrait and [indistinct ] your [ indistinct ] in landscape. If the user wants to go in
landscape, they can just turn the device which they will have to do anyway if you do it for
them. But if they want to stay in portrait then they can't. so I think you should let
the user decide what they want and it's less work for you. So that's probably the best
>>Trevor: I mean, like you said, there are several apps out there that do do this. Games,
Netflix does it. But you know, an example of just compare Netflix and YouTube. Right.
YouTube, if you're in portrait mode it finds a way to play the video in portrait. And I
think that's a good model to follow whenever possible.
>>Joe: I'm familiar with several note taking apps that are currently available for Android
and none of them force you to go into portrait or landscape. You might find that in portrait
it's much more difficult to write your notes. But certainly if you choose to do that it's
easier than if the application forces you to go one way or another.
>>Trevor: Yep.
>>Romain: And look what happened with the launcher on Nexus 7. It's always in portrait
and so the number one feature request we get is can we get the launcher to go in landscape
as well. So I think users don't really like it when you choose the orientation for them.
>>Joe: OK. I think we have unfortunately run out of time. I'm really happy that we got
so much participation live from our Hangout. Thank you very much. I hope people will stop
in again next week. And until then, we'll all say goodbye.
>>Trevor: Alright, we'll see ya everyone.
[techno music plays]