Be part of document-centric Android
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 46 | |
Author | ||
License | CC Attribution 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/47168 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
droidcon Berlin 201532 / 46
5
7
10
13
16
18
20
21
23
26
31
34
35
36
41
42
45
00:00
RepetitionMultiplicationMobile appTouchscreenPasswordAndroid (robot)Lecture/Conference
00:42
Data storage deviceSoftware frameworkTouchscreenAndroid (robot)Content (media)Software frameworkBitData storage deviceMereologyPoint cloudInternet service providerMobile appClient (computing)Software developerOpen setComputer animationLecture/ConferenceMeeting/Interview
01:35
Data storage deviceSoftware frameworkStandard deviationConsistencyMobile appComputer-generated imageryComputer fileStandard deviationUser interfaceInternet service providerData storage devicePoint cloudComputer animation
01:58
Software frameworkData storage deviceMobile appImage resolutionBitGoodness of fitComputer fileProbability density functionMeeting/InterviewComputer animationLecture/Conference
02:28
Content (media)Different (Kate Ryan album)Software developerCodeMeeting/Interview
02:58
Content (media)Software frameworkData storage deviceContent (media)Computer fileMobile appData managementEmulatorData storage deviceAndroid (robot)Group actionMeeting/Interview
03:27
Content (media)Android (robot)Mobile appData storage deviceImage resolutionGroup actionContent (media)Internet service providerSoftware framework
04:10
User interfaceContent (media)PlanningPoint cloudComputer fileElectronic mailing listData managementType theoryGroup actionLecture/ConferenceComputer animation
04:36
Content (media)BuildingRevision controlRevision controlMedical imagingType theoryCASE <Informatik>BitContent (media)Data storage deviceResultantMobile appField (computer science)MathematicsMultiplicationSoftware frameworkObject (grammar)Meeting/InterviewXMLUML
05:40
CloningComputer configurationContent (media)Directory serviceData managementComputer fileContent (media)Computer configurationMobile appLecture/ConferenceMeeting/InterviewComputer animation
06:07
Content (media)Level (video gaming)Data storage deviceMobile appPoint cloudMedical imagingShared memoryComputer fileData managementSoftwareInternet service providerDirectory serviceAndroid (robot)Lecture/ConferenceMeeting/Interview
06:44
CloningDirectory serviceData managementPlastikkarteComputer fileRegular graphGreatest elementLecture/Conference
07:16
String (computer science)Directory serviceGroup actionContent (media)Point cloudElectronic mailing listComputer fileData managementOpen sourceProjective planeSource codeDirectory serviceComputer configurationPoint cloudData storage deviceFile Transfer ProtocolComputer animation
07:51
Point cloudCloud computingMobile appLecture/ConferenceMeeting/Interview
08:13
Content (media)Group actionGroup actionElectronic mailing listSoftware frameworkDirectory serviceComputer filePhysical systemInternet service providerData storage devicePoint cloudContent (media)Lecture/Conference
08:47
Directory serviceString (computer science)Network topologyContent (media)Computer-generated imageryGroup actionType theoryDifferent (Kate Ryan album)Directory serviceMobile appTerm (mathematics)Computer fileLocal ringCASE <Informatik>Physical systemNetwork topologyLecture/ConferenceComputer animation
09:34
Computer fileNetwork topologyResultantBitDirectory serviceLecture/Conference
09:55
Directory serviceString (computer science)Network topologyContent (media)GoogolDirectory serviceComputer fileMobile appOpen setData storage deviceInternet service providerInterface (computing)Network topologyComputer animationLecture/Conference
10:31
Network topologyMobile appTouchscreenInterface (computing)BitPoint cloudData storage deviceInternet service providerSoftware frameworkService (economics)Open setMobile appClient (computing)Network topologyLecture/Conference
11:12
Mobile appTouchscreenSoftware developerTouchscreenRight angleAndroid (robot)Goodness of fitLecture/Conference
11:33
Mobile appGoodness of fitRight angleElectronic mailing listMobile appTouchscreenOpen setMeeting/Interview
12:05
TouchscreenMobile appGraphical user interfaceComputer configurationFunctional (mathematics)Graph coloringMeeting/Interview
12:43
Task (computing)GradientTask (computing)Event horizonMessage passingMobile appLink (knot theory)LogicControl flowFlagEmailKey (cryptography)GoogolLecture/ConferenceXMLUML
13:23
Computer iconControl flowFile viewerMobile appMedical imagingLink (knot theory)EmailFlagView (database)LogicLecture/Conference
13:54
Medical imagingTouchscreenEmailMobile appTask (computing)File viewerXMLUML
14:16
File viewerMedical imagingFlagCASE <Informatik>Lecture/ConferenceMeeting/Interview
14:41
TouchscreenTask (computing)FlagMultiplicationMultiplication signLecture/ConferenceComputer animation
15:01
FlagTask (computing)Demo (music)Similarity (geometry)Task (computing)MultiplicationFlagComputer animation
15:24
FlagAttribute grammarExistenceElement (mathematics)FlagMultiplication signTask (computing)Attribute grammarMultiplicationDefault (computer science)WeightLecture/ConferenceMeeting/InterviewComputer animation
16:20
Task (computing)Mobile appDefault (computer science)Functional (mathematics)TouchscreenGraph coloringComputer iconWebsiteMathematicsGraphical user interfaceLecture/Conference
17:21
Mobile appTouchscreenLecture/Conference
17:43
Task (computing)Computer iconCodeTask (computing)Computer iconDescriptive statisticsObject (grammar)Graph coloringXMLComputer animation
18:09
Task (computing)Computer configurationKey (cryptography)MultiplicationGraphical user interfaceBoss CorporationWindowLecture/Conference
18:40
Task (computing)Task (computing)Data managementGraphical user interfaceElectronic mailing listInformationFunctional (mathematics)Physical systemMobile appTouchscreenComputer animation
19:57
Task (computing)1 (number)Graphical user interfaceSystem callTask (computing)CognitionGreatest elementTouchscreenMobile appLink (knot theory)Web pageSelectivity (electronic)Ocean currentOpen setGroup actionWeb browserLecture/ConferenceMeeting/Interview
21:13
Finite element methodComputer configurationObject (grammar)Task (computing)Computer configurationImplementationSoftware developerFunctional (mathematics)FlagFiber bundleBitSet (mathematics)Lecture/ConferenceMeeting/InterviewXMLComputer animation
21:51
Default (computer science)TouchscreenBitRootLecture/Conference
22:26
Attribute grammarDefault (computer science)BootingState of matterAttribute grammarTask (computing)RootElement (mathematics)FlagMobile appContent (media)TouchscreenComputer configurationFiber bundleComputer animation
23:42
Task (computing)Multiplication signLecture/Conference
24:03
Task (computing)Data storage deviceSoftware frameworkInternet service providerLibrary (computing)Cloud computingTouchscreenComputer configurationBitClient (computing)Android (robot)Lecture/ConferenceMeeting/InterviewComputer animation
24:50
Medical imagingFlagFile viewerTask (computing)Point (geometry)Mobile appMultiplicationTouchscreenContent (media)Graphical user interfaceLecture/Conference
25:55
RepetitionTask (computing)FlagFunctional (mathematics)Software frameworkMobile appData storage deviceLecture/ConferenceMeeting/Interview
26:22
Lecture/Conference
Transcript: English(auto-generated)
00:06
Hello, thank you Paul. Sorry for the technical difficulties, you know. Non-mainstream OS, so. I shortened the talk to document-centric Android, and I chose that because it's a nice buzzword, and I was hoping I was selected
00:21
to talk to you as a speaker, so that worked out well. Next thing, I had to come up with actual topic, because it's just a buzzword, so. Google used that for the feature that was introduced in Lollipop, where what previously was the recently used app screen, you can now have multiple entries per app,
00:41
so that was the buzzword for that. But then I thought, you know, that's too little content to talk about for 30 minutes, so now you get two topics for the price of one. We'll talk a little bit about the Storage Access Framework, and then about this new document-centric Android.
01:01
And we will start with the Storage Access Framework. I will not talk about the whole thing, because what I like to call server-side part is really involved, and not too interesting for many of you, unless you're a cloud storage provider that writes an app on Android, it's not terribly exciting.
01:20
The client part on the other side is useful for most of us developers. So Storage Access Framework, what is it? It's basically a framework that unifies opening app, opening documents, or creating documents. You have these document providers
01:41
that provide access to the documents, wherever those may be on your local storage in the cloud, or you make them up as you go, that's possible too. The important thing for users is there's a standard user interface to access those documents, and we will see how that looks like in a minute. First, we'll see how you go about now,
02:04
or pre the Storage Access Framework was introduced in KitKat, so pre-KitKat, how things looked like. Oh, awesome. I had these nice animations, then I exported it to PDF, and now you see all at once. So let's go over them one by, oh, the resolution is also not too good,
02:22
so I guess that's good. We see example of three apps that have custom file pickers, and as you can see, they look a bit different, but they all do the same thing, so there's lots of code duplication, which is always hers, at least for me as a developer, everyone is doing the same thing, and it looks different, that's kind of bad for users,
02:44
but that's the way you kind of had to do it until now. You also had the chance to use the get content intent that would display a dialogue like this, and you could choose the app which supported
03:01
to deliver your content. As you can see, there's no file manager if we disregard the one that's installed on the Genymotion emulator, because Android didn't ship with a file manager, and as it turns out, people still like to select files on their local storage, so that's a pretty popular segment
03:23
in the app store of file managers, even though it's kind of a boring tool. So, action get content was kind of pimped with the introduction of the Storage Access Framework, now it looks like this. Again, the resolution is not too great, but we see on the left what it looked like previously,
03:43
now you don't get a dialogue, you get a whole activity, and apps that support the Storage Access Framework, for example, Google Drive, they show up up here as a document provider, and the other apps which only support the old way, of course you can still use them, they show up down here, and if you click down here,
04:05
they will show their own custom UI. If you click on Drive, I hope we will see that right now, oh no, okay, so we see all at once, so if you click on Drive, you will see something like that which is a file listing,
04:21
much like a file manager would show, only that these can be in the cloud, like my world domination plans on Google Drive. Okay, so that's the way you were doing it, you just use the action, you specify a type that you want to get, in this case images,
04:41
and then you create a chooser, and like I said, in the old version, you saw the dialogue, in the new version, you see the new UI. So there wasn't a change mark, that still works, a small introduction I like very much is that you can now select multiple documents,
05:03
so just by specifying this little extra apps that support it, that is the storage access framework, you can select multiple items, it gets a bit more involved when you actually get the results back, because previously you had to read the content URI
05:20
to your content from the data field of the intent, they didn't change that, there's still just room for one URI, but with I believe Jelly Bean, they introduced the clip data object, and there you can put multiple URIs in there, and it also works out with permissions, which is important.
05:40
So as a user, you just have to check is something in clip data, then use that, if not, do the old way. So that was getting content, if you wanted to save content, there were a lot more options, so one is you could use the download manager, so just write the file to the download folder,
06:02
and then say to the download manager, I have some content here, the upside of that is it shows up in the download app that is shipped with Android, the downside is if you're, I don't know, an image creation software, the user wouldn't expect the content to end up in the download app. You could also use the share intent,
06:21
which is supported by most cloud storage providers, so by saying share, you can actually save the content to the cloud. Then there's a way of writing just through hard coded directories, you maybe, if you open a file manager, you see that every app creates its own folder there,
06:42
and the top level SD card, so that's always fun. There are a couple of more ways, oh, damn, okay, so here was a picture of a file manager where you could select a directory, so it looks like the regular file manager only had the button on the bottom,
07:02
where you can say select directory, and then you get a file URI to that directory back and basically go about just as with a hard coded directory just with a selected one. Sadly, there's no standard intent to do that, so I copied that from my little open source project.
07:21
You might end up with a listing like that with tons of intents, and then you have to check, oh, is this file manager installed, then do that. If another one is installed, do that. So it wasn't pretty. In the other option you can do is provide the all-in-one custom solution
07:43
that is your own directory picker or you support some last century cloud storage solution like FTP, but the downside is you have to integrate the SDKs of all the cloud storages you want to support in your app,
08:03
so that's not really a great solution, I guess. So the new way is you have an intent for that. The create document action, and it will display the UI we already know
08:20
from the search access framework, so here could actually be the listing of the directory. Here is random files. Below you can specify a file name and then hit the save button. Then you will get a URI you can use to write the content there, and the system will transparently move it to the document provider
08:42
and it gets uploaded to the cloud, written to your local storage or just forgotten. That's how you do it. Much like we saw before, you have the action, you have a type, you can specify a title. That's the suggestion for the file name.
09:01
The user can still change it. In this case we have corgi-jpg. The rest, that's stuff you just have to do. Then, different topic, again, no nice animations. You can also pick a directory. So we saw some apps implement a custom directory picker.
09:22
The new system also has you covered there. So you can request to open a documentary, which is basically a fancy term for what previously was a directory or is a directory locally. And then you can access all subdirectories or all files in there.
09:41
So that's pretty neat. It gets a bit involved when you get the result back because you get a tree URI, you can do nothing with that except for requesting a document UI and with that you can create a document URI and with that you can then access the directory
10:03
or create new files, stuff like that. Okay, so here's what it looks like, sadly. I installed some apps that already implement the new document provider. And if you use the open documentary intent,
10:24
only the built-in internal storage supports that, not even Google Drive, which was, I think, the first app that supported the document provider interface. So that's a bit sales. If any of you are working for a cloud storage provider, please fix that because it's a nice feature
10:41
and I want to use it. Okay, so much about the storage access framework. Like I said, that's more of the client side, so writing the document provider obviously is not that easy, otherwise we had a ton of apps that already supported it but right now it's very few.
11:01
Dropbox doesn't support it, which is really a shame because I use them. Microsoft OneDrive does support it, except for the open documentary, so. If someone from Dropbox is here, Microsoft supports it. Right, okay, so the overview screen. It was introduced with Lollipop, I don't know.
11:23
How many of you are pre-Lollipop on their personal device? Okay, that's not too many. Okay, we're an Android developer conference. I'd say about 10% or maybe 15, that's good. So you already should know how it looks like. I think, like I said, no animation,
11:42
so I think we will see how it looked like before. Right, okay, so on Android 4 devices, when you click the soft button on the lower right, you will see this screen and it's basically the list of the recently used apps. One app, one entry here, you can see Chrome,
12:02
and in this screen you can't see it, but there are currently two or three tabs open, but it gets just one entry. In Lollipop, Chrome, I think, was also the first app to support that. You get, or you have the option to have one entry per tab in Chrome here.
12:24
That's two entries, and yeah. They also added another functionality I will talk about later, which makes this screenshot very busy, because there are lots of colors and you don't really know where one thing ends and the next starts, but the animation when you play with it is rather nice and I like it a lot.
12:45
Okay, again, no animations, so I have to tell you what I grayed out here. The old way to open content, say you're an email app and you display a message
13:02
and there's a link in there. The user clicks on that. Previously you specified the clear, or Google asked you to specify the clear when task reset flag, which meant here's a logical break. I'm starting a new activity and this activity will launch in my activity task,
13:21
but it doesn't really belong to me. When the user switches to another app, then goes back to the home screen and clicks on the launcher icon to start my email app again, please don't display whatever activity I launched, say an image viewer because the link was to an image. Please don't show that, but display the mail again.
13:45
So Google thought, okay, so we have this logic break. We just use that in Lollipop and rename it to flag activity new document, which basically says, okay, we're launching something that doesn't belong to our app.
14:00
Previously it was the same activity task. Now it's a separate one and you get an entry in the overview screen. So if again you launch an image viewer, you will get a new entry in the overview screen and when you switch back to the email app without any magic, you're back in the email and if you decide you want to go back to the picture,
14:22
again, you can do that. You don't have to destroy the image viewer activity and it's gone forever. Okay, so if you specify or if you add the new document flag, not in all cases an actual new activity is launched.
14:42
It's similar to new task. If there's already an existing activity, this one will be reused or brought to the front. If you really absolutely want to create a new task each time, you have to add a new flag called multiple,
15:04
it's not a new flag, it was an existing one. You have to add another flag, the multiple task one. In the demo apps, you can end up with a lot of similar activities soon. So if you don't absolutely have to, I discourage that.
15:21
So if you can, you should reuse tasks if they're already there. But the proper way to do that, so ideally you don't want to specify to add a flag each time you want to launch an activity. If you say, I want to always launch a new document task,
15:40
you can add an attribute to your activity element in the manifest, either specifying always, which always opens a new document task, much like if you specified the new document and multiple task. Into existing is much like just specifying new documents so you get it once and if it's already there,
16:01
it's brought to the front. Never just ignores the flag, so even if you specify a new document, you will get the default launch behavior that is in your task unless you have other flags. And none is the default which does whatever flags you give the launching intent.
16:21
Okay, and I mentioned this before. They added also functionality to change the look and feel. So the default look of your app in the recent screen is just whatever was on the screen and then this is not the actual toolbar
16:40
that was on the screen, it's a layer on top. It displays the app icon and then the title of the activity with, I think the gray is the default but I'm not sure on that so don't quote me. You can manually specify that so change the icon, change the title and the color of the bar.
17:03
So if you have really multiple documents, you should probably specify the document title here. Chrome for example just uses the title of the website here. If you really only want one entry here, like traditional recent app screen,
17:22
you might want to change that and use your app name here instead of whatever was the activity title. So if you're an account selector and your activity title is accounts, the user probably won't be too happy if accounts shows up here in the recent screen because I imagine lots of apps
17:40
that support multiple accounts have an account screen. Okay, that's how you do it in code. It's pretty easy, just create a task description object with all the information and call this method on the activity. Some of the things are optional, I forgot which. I think the icon and the color,
18:01
I'm not sure about the title so if you can just change the icon. But you can find that out. The documentation is usually pretty good. Read it. You can also manage your document task so if you have multiple, Chrome for example
18:21
has the option if you open an incognito window, a tab or multiple of them, you will get an ongoing notification and if you click that, all incognito tabs are closed. That's kind of the modern boss key. Get rid of the incognito tabs.
18:42
So activity has a method finish and remove task which finishes and removes the task. Also from the overview screen, if you close an activity in a normal way by just calling finish, there will stay an entry in the overview screen
19:00
because the user might want to go back to it. So you have to consider that. Don't just remove everything, maybe the user wants to go back. Even though the activity is finished, the system remembers the intent to create it so if the user clicks back on it, the activity will be relaunched.
19:20
Then there's also the get app tasks method in the activity manager where you can get a list of all the tasks. Then you can finish and remove task on arbitrary tasks to remove it. You can call move to front which moves it to the front. You can start an activity on a task that is not your own
19:43
which is also kind of nice. And like I said, the system remembers the base intent that was used to create the task so that's here in get task info base intent. That's probably also what you would use if you were to implement a functionality like Chrome has
20:01
so close all incognito activities. You would iterate over all of them, just find the one that incognito wants and call finish and remove task on them. Yeah, and if you like, you could even implement an app internal task switcher with a move to front thing but I hope you won't do that.
20:22
Another feature that I haven't seen any app using besides Chrome is make task launch behind. So if you long press on a link in Chrome and select open a new tab, you will see a short animation. A new activity will show on the bottom and then immediately disappear so your current webpage will stay active
20:41
but if you go to the overview screen, you will see multiple entries here and they are grouped. So the spacing here is the normal one and then those are grouped together. There's sadly no way around so you can't, at least I haven't found a way to launch something in the background and then have a regular grouping,
21:03
they will just say like that. But nevertheless, you can switch between them like any of the other entries in the overview screen. You do that very easily. You just call activity options, make task launch behind to get an object
21:22
and then you call the to bundle method and use the special start activity method with a bundle. That's basically responsible so the implementation detail is a bit nay. They have a flag for the animation, show it and then immediately disappear
21:41
and apparently they also use that animation flag for the actual functionality of the grouping. It's a bit sad. It hurts me as a developer but okay. There's another feature in Lollipop. By default, the entries in the overview screen
22:02
are persisted so you probably notice that if you're not on KitKat that when you reboot your device and go to the overview screen, you have lots of entries there. At least I never clear them manually so lots of entries there. You can actually control that a little bit
22:21
so the default is that the root is persisted, that is the base intent is remembered and if you actually select one of them, the app is relaunched or the activity. You can set the flag, again that's an attribute on the activity element in the manifest.
22:41
If you specify persist never, the entries in the overview screen will be forgotten after the reboot. Then there's also the persist across reboots and you can specify that for basically for all activities and when saving content, it will go to the roots
23:03
of the document task and check if the flag is there then the activity will have the option to save the content and then it will go one up and it will save the state for all of them until an activity is reached where this flag isn't specified.
23:21
That's just gone after the reboot. Of course they had to invent something new to actually persist the state and that's a persistable bundle, you can't really see it here but it's written there. Documentation on that is a bit vague and if you were to ask me, I would recommend not to use that
23:41
because I'm not sure if they really intend to make that known too much. Like I said, the documentation is not too good on that. Okay, I guess I hurried a lot so we get more time. That's already the end of my talk, a quick summary.
24:03
I like the storage access framework a lot. I also implemented documents provider. That's why I didn't want to talk about it. It's quite a bit of work but on the client side, I think it's very nice because it gives the users a lot of new and nice options.
24:21
Sadly, it's a KitKat and above thing only. To the best of my knowledge, there's no compact library that does something sensible on Android 4 before KitKat. And the cloud providers don't support all of it.
24:42
So the open documentary is a really cool thing. I like it but again, nobody supports it. So the new document centric overview screen is kind of a nice thing. I guess most of you don't need the multiple entries like Chrome because that's just overkill
25:02
or you don't have, even if you have an image viewer, you don't switch between five images because they are so awesome. You just watch them one after another. So one entry is plenty but if you launch external activities, you might want to specify that flag
25:21
because users probably want to go back to your app and then at some later point, go back to the content they opened. So that wasn't really possible before. You could launch the external activity with new task and then a new task would be created for that one but again, switching back and forth is difficult
25:42
because there's only one entry for the app of the external activities. So there's a good chance you couldn't go back to the content. Yeah, so please make use of the small features it's not an all or nothing thing.
26:03
Just sprinkle the new document flags here and there and I'm sure your users will be very grateful if your app is nicer to use. Also, storage access framework like I said, I as a user of my phone, I really like the new dialogue and the functionality it brings.
26:21
So that's it from me, thank you.