 So my name is Jingxin Wang. I'm running a Drupal and Android shop in Shanghai, China So this session is a building Android apps with Drupal Some people might also know me because I my previous startup was doing a beer website and we also created a beer cloud iPhone and Android application based with based on Drupal So let me show you a video first So this video was from a Google project. They are teaching Building programmatic robotic car So in this session, I'd like to invite you guys to think about how can we build the same infrastructure for your applications or for your For your business need The goal of this session is to envision us to build interesting application beyond simple websites So if you come here, just want to build a simple website to expose your web content to a mobile Clients then this session might not be interesting to you Well, if you come here because you are interesting some Android codes And I will not share a lot of codes in this session But I will post a project open source project library during this session So if you are interesting IOS this is Android arguments I'm not going to Do a lot this in doing this session. Please find me after doing the parties I really like those arguments, especially when there's beer involved So the online of this session we're gonna talk about the state of Android We're gonna talk about the difference between native applications and web applications then we're gonna talk about some Framework JUPO services or JUPO 8 and the JUPO cloud which is the open source library on Android and To communicate with the JUPO services Then we're gonna talk about some interesting modules like a views location proximity search barcode C2DM and Then we're gonna talk about a little bit Analytics traffic analytics, there's a server-side analytics and the client-side analytics Then we're gonna come back to talk about The supercar how can we build a supercar infrastructure? How can we build the? Artificial intelligence over the cloud Then we're gonna do some QA and even we have extra minutes. I will teach you Chinese So this is a from a mobile mobile world Congress 2012 which happened in the last month So over 450,000 application Android play which also enjoyed a market a total of 300 a million Android phones have been activated and Over 850,000 phones and tablets are activated today So this is a the number of Devices or activation happen for Android Let's look at the market share According to come court come score Google Android is almost having a 50% market share among all the smartphone platforms And this is a worldwide and mark Android market share You can see in during 2011 the Android market share is about the 40% and By the end of 2012 we expect to see the overall Android market share will reach 50% so probably Many people will know Android have many builds or distribution So you can the graphic on the left will show you the percentage of each distribution We can see most people now stay on 2.2 or above So what is Android super phone on the left on the top right? There's a graphic of the application screenshot of application that I build a few years ago So basically you'll use barcode scanner to scan the barcode the 12-digit barcode out of a beer And it will tell you the information about the spear The ABV the color and where you can buy it So how can we build this application like this? We cannot we cannot just rely on the Computation power on the local machine. We need something. We need a back end. We need a server and in the In the coming slides, I will tell you more about how we build this kind of application And it will be the same infrastructure of framework for building the super car So for Android super phones, we have NFC. We have gravity sensors We have a lot of extra sensors like light human humidity and pressure So those sensors sensors on the phone will make a lot of things interesting those sensor sensors are carried within your device in your pocket and You can reach it out anytime If a phone if a super phone get stolen and if you Someone took it away. You'll be you will become feel you will feel nervous in those days Because you need those sensors. You need a GPS to tell you where you are You needed those Google Maps and those applications to tell you where to go to your destination so This kind of phone or this application make the phone super phone Where do we or did we see Android? It came out in 2008 as with T-Mobile G1 then later on we can see EPC Google TV Google tablet and Google microwave not a Google microwave. Sorry. It's Android and microwave someone use the Android to build the controller system for a microwave and Last year. We also heard about the Android home program So Google has this vision to control your home using Android system We also do we see Android will all will we will see Android in 2012 in February During the C CES conference There's a demo for the super car built by NVIDIA It's a Nambu Gili car So we all know and NVIDIA is actually pardoning using Android So very likely in the next one or two years We will see super cars powered by Android then we can do a lot of fun thing with it. I Really like this super car idea because speeding is fun, especially when you don't need to get into an accident So by the way, if someone liked my presentation at the end I would like I mean I would like the investor to give me some money to buy a Nambu Gili for future development So recently we also see some Android applications That you can turn on to record your physical exercise exercises And then in the near future We're gonna see bicycles building with Android and it has extra sensors to record everything all the data and in the in the future we might see Google toilet come out because it's fun to To analyze Your daily food right and give you a report at the end of month and tell you how much beer You can drink or how much wine you can drink for the next month. We also see some Android powder like a Weird thing happened in the past two years So some people some people try to build an interesting application with G1 then last we will also see This like a computer powered What's the word plus? process that set a good limb So and this application really require multi-threading capability from Android Think about it if you using this a process that prosthetic limb to drive a car and if you don't have Merchard multi-threading handling and someone call you on your on your limb and Your your limb froze and you gonna hit some some trees So we're gonna talk about the Android multi-threading capabilities. So Besides Android, there's another open source hardware called the audit ring other, you know So the future is only limited by the imagination you have an open source Software on one hand have an open source of hardware on the other hand and you can use those open source hardware source Software to build sensors to you build a control controller systems to collect data and Send it back to the server and this is what called your big with this computing Basically, you make everything every physical things to collect data and respond to your commands So why Android? Well first it is because it's open source. We are doing triple stuff. So we love open source of software and It's also optimized for connectivity and the limited the hardware sort resources So what I'm saying connectivity is that the means sharing or communicate with other devices using Wi-Fi? mobile radio Bluetooth NFC or even camera You can scan a barcode out of a cat. I mean you can scan a barcode with camera and Extract the data out of those encoded symbols So Android is really optimized for those connectivities Devices are not if devices are not connected then they are not interesting. So at the beginning I I Mentioned that if you this section is a try to envision us to build something more interesting If you just want us want the application Android application to expose to your web content to make a Mobile presence then you can use HTML5 or build a web applications. That's fine but to build something like a super car to build something like a Application can scan a beer bottle and read information then you need you need something that can handle multi-threading so For this session, we assume that HTML5 It's great thing, but it's not there yet because the libraries and the practice is is still far behind And to do native apps we also benefits from the Android market distribution channel if you build an application submitted to Google and a suddenly it becomes available to all the countries and all the languages and You have a nice dashboard for analytics data So multi-threading a synchronized computing and Interaction with the application is a strength of Android Let's let's take a look at the how application work in general so the for the for the iOS for out for all other Mobile operating system if you want to use application. It's like you go into a room you open the door and You do something in the room and you come out and you close the door and You launch another application by going to another door and you do something with it and you come back and close the door So this this is the traditional application life cycle But Android is different You're going to one door you do something and you open another door You could some other places and you launch as another Applications and you get a lot some people Complain it's a usability issue but the great The great thing about this life cycle is application can share the functionality or API or data resources you don't have to open one application get out and Open another application do something and get home You can launch application within application and you can share user data or other functionality Interesting functionality among all applications. It's like a Drupal hooks, right? We we build the modules. We let the modules talk to each other We let it use views to talk to a content nodes and we use rules or Notification system to work with a bunch of actions and We also have user management and the workflow. So everything work together smoothly nicely and This is also true for Android So I have talked about Android allowed and why do we need a Drupal? So let me give you one example has anyone played with a Google translator. Thank you so How Google translator work? Is that there are one application on your mobile phone? It does the voice recording send the voice Record the voice and send the voice file or data to One server then this one so when back end server on the Google cloud computing system We are send this data to many other servers is so the server each server will Decode your voice and this and try to do something with it So some some server will say oh this guy has a British accent so he actually means this and Another server say this voice is recorded in Denver that might mean something else or the other voice is saying I mean the other server is saying oh, I like this I think the translation should be this and the another server was saying we'll say I think the translation should be another contacts and then the server will have votes and so Google server the back end actually doing a lot of Different interesting things with the recorded voice and at the end they will each server We will have a votes and send the corrected the translated the file back to your local I'm sorry local client So all those interesting things happen actually in the cloud not on your not on your Android phone So this application this framework Implies that we will need a very powerful scalable infrastructure on the cloud to deal to deal any request that That might need a lot of computational power or interesting data. We want to use the shared data among I mean cross the system So that's why we need a Drupal So Drupal comes in as a back end to power those magic So you for the application for the application I build Which is let you scan scan a beer bottle and read your information or find a beer near you In the bars or restaurant you you send the request you actually scan the beer bottle and then the Local application will transcribe the image into text the text will be sent to the Drupal and There are a lot of UPC data stored with barcode module as a field in the Drupal system then Drupal will do a query and find that the The matching notes and it will send the true send the content back to the local machine so We believe a Drupal is one of the major component to power the future applications and That's why we need a Drupal this is the architecture example from my previous application and I just throw it here. I just want people to get a big picture of How things work with each other? For my case study, I have beer brewers beer distributors beer consumers And beer retailers like a bar restaurant Each of those people take a ticket they are rose to enter content social content like how they brew beer What's the ABV of a beer and what's the color history of the beer and the retailers will enter their sales information like How many of those bottle of beer is sold at this place and When we when was this beer so Something like that. So a lot of people using the traditional web presence to end and enter they are interesting to data on the other hand There are consumers of beer beer lovers with mobile phones. They are interested the history of the beer The information of the beer and where to find it So they use smartphones to access those data So the architecture will look like this. There are two portals web presence and a mobile presence so How can we do this? We want to expose the content workflow and even other interesting resources to mobile we use Drupal services are in With Drupal aid services will be in call With the Drupal services the Drupal has the capability to exchange data information data resources with other systems such as Android flash iOS or any other Restor support system This is a very simple diagram and I do that Think if we consider Drupal all that box right now, it has three layers Presentation layer call application layer and the storage layer With the Drupal services with Drupal aid, there will be one additional layer That's the communication layer is the responsibility of this communication layer is to build a standard communication ways such as rest or server procedures using OAuth Authentications So this application make the resources reusable and accessible for other platforms so if we're building if we're building application on the Android that means we can use as much resources as possible from Drupal we can use views taxonomy user entities and Workflow all kinds of resources and we only need to rebuild the presentation layer on Android so for Android if the Android application is a part of your Road roadmap that means You only need to find a theme for Android All those data can be accessed or exported and live communicated with Drupal So Drupal web services Give you this API's for exporting or Accessing users permissions workflows rules actions e-commerce views taxonomy File search and other entities and it's extensible. It's a very extensible framework. You can define your own resources. I Won't go into very too much details about a Drupal services because there are a lot of session about a Drupal services and the mobile development sessions for this conference and For this session, I'm not going to too much Technical and if you are interested in mobile the actual coding and the actual actual Programming, please find out the sessions So we have this framework on the Drupal side We are exposing Exposing those resources to the other system on Android on Android side We also need a mirror system or a mirroring API to access the resources on the Drupal Because we don't want to build everything from scratch We want to have a system that talk to Drupal directly and you if you want something you can just make an API call on Android and such as give me node one two three and This framework will use the communication layers to talk to Drupal and get the data back so if we have this two Frameworks on two sides that means the Android the Android developers Not the nest do not necessarily need to understand Drupal like us We can just give them the full documentation and tell them how to use the APIs and they will get the resources They want to build the interesting Applications the Drupal cloud a library was built by me Maybe in early 2010. I haven't done much maintenance on it, but it's not fully it's not a documented Library, but at least I give it to you You can use it as an example to hack it to to try to understand how Android the basics of the web service communication so We want to use a Drupal because there are a lot of modules built already There are interesting things such as a views and the views as a service is more services a plug-in or extension that means Anything that you can do with the views on the Drupal side You can use the same thing on the Android side. You can use the views to query it stuff the entry the the content and assorted and it makes a filter and You can do the same thing with Android using this using the Drupal cloud API or the Extended extended library that you will develop Barcode is another module that I I mentioned this module simply is a few the module extension that it can store different barcodes such as UPC and Even QR codes two-dimensional and does a very simple verification and those this data stored like in the fields in the It's a fieldable and then even the mobile Application need to access it. You can use views and services to do very simple API calls Location and the GMAP is another interesting combo because you on the mobile phones Very commonly you will you you will take advantage of GPS You will have the latitude and longitude. You want to do the proximity search and All those things are already finished done on the Drupal end Because the location and GMAP has a view extension which does proximity search already So if you have a if you have a Drupal website with hundred of thousand Notes with locations, then you can simply query the closest notes with Location GMAP views views plugging So that means you can you can rebuild the full square overnight, right? Flag is another interesting module because you can do a lot I mean people already know flag you can use a flag to build a bookmarks favorites and a lot of interesting application and This can be also take advantage of on the on the mobile end if you if your user Like to save something just click one button and the Android Android will call the Flag service and the flag service will take advantage of a flag module So all those interesting application can be viewed overnight How great is that? Drupal commerce is another interesting thing, but unfortunately we don't have Drupal commerce service Module available yet, but I bet many people are trying to do it Some people already hacked have hacked a version and some people trying to do it in your You know in a Drupal way Say to a DM is another module I have this module like a Project profile created on Drupal on Drupal.org a long time ago but I haven't really committed any code and Some people are interested in this what this module does is using the cloud to device messaging system which is built by Google basically is a push notification we have a notification system on Drupal and a messaging system is a great system and You can you can push notification based on user Comments or subscribe based on content types It's very extensible. So you can hook that with C2DM module basically You can push make a push notification to Android clients and The rest of the application will take care from there Google Analytics service is another module that I created a few years ago the goal of this module is tracking the traffic coming from mobile Is anyone familiar with how Google Analytics work? Okay So let me give you a very simple version Google Analytics actually created a very simple image on your on the web and your browser We'll download that image while downloading this image your browser is actually sending all your information about your computer to Google Analytics server But when we build native application We are not we are not using browsers or at least if you don't use web webkid or web app Then you are not making browser the standard the browser downloading image calls So all those traffic are not recorded by Google Analytics if you already have Google Analytics installed on your server so I I use the Google Analytics the The library and the modified modified the library make a Google Analytics service in module What which this does is that we'll shift the responsibility of reporting the traffic I mean sorry reporting the user information from the client side to the server side So for example if you use a native application to make the services call to your triple application to your triple website your client is actually telling your triple server some information about the client information then the Drupal Website is actually making the functional call to Google Analytics analytics and reporting this traffic So this is a front. This is different from you having a website Sorry, you're using a web browser open website and the web browser Sorry responsible for reporting that the traffic so from future information about the Google Analytics please please read the documentation and on the Google Analytics service module as I mentioned a As I also mentioned that there is also client side analytics report So I'm enjoyed you can download the STK to actually report to build the application to build the Google Analytics functionality within your application. So the difference is for this Analytics reporting mechanism is that your native application is using the STK offered by Google to do the reporting on the client side It it might it might be more interesting if you have to Record something like how many how many times this user have to click this button? And it might be interesting if you want to record how many times these people have to do some gestures Because all those native advocate application SDK Give you those APIs to record the user user information or user activities on the client side This is the Google service and Google Analytics service Everything is on the Drupal side and you cannot actually track the user's activities So for for analytic for analytics We want to define a few things What is a page view? right for the for the Google Analytics service that I developed It was a very simple version. I make everything a page view But some people might say if I make a flag services call does that come as a page view? So for for Google Analytics, we want to define page view event tracking Commerce tracking and otherwise otherwise variables For the module I already developed It doesn't support that money So maybe some people can patch it some people can have a new branch and do more interesting thing But at the moment it only support a page view tracking But if you use the Google Analytics SDK For the client side reporting then you can do all those things But again, you need to define. What is page view? Because you are using applications You are looking at a one screen if you shift from one screen to another screen does that kind of as a page view? If you click this button, I like this item that's that kind of as a page view So I haven't talked about a lot about the Google Drupal and Android integration and that's some interesting modules. I Would like to invite you guys back to the building future as the super cars At the beginning we saw the video that some the Google engineers was building artificial Intelligence control that cars you can push a button and the car can drive it itself So where is the framework that I discussed earlier in this section that you will have this infrastructure? We'll have this artificial intelligence on the cloud and you will have your Android phone as a local controller They will have the all the sensors that you need if you don't have enough you can use the art Arduino to build the extensional sensors to collect all the information Now all the information are traveled back to our servers and you have many triple website doing different things Some triple site can vote on the content submitted can store the data and the generated reports Doing some statistics and then send the comment the comments back so There are a few things that I list on this this slide that we can start doing and a very simple thing Like storing all the locations and a track all every for every set Sorry for every three seconds of the track we are GPS GPS data Longitude and legitude and submitted to Drupal and a story then suddenly over a month you have like thousands of thousands of millions of Location data, then you can do proximity search Now if you and the Android side, we also can collect a data such as gas speed and direction track directional tracking Android itself doesn't do this so you need to have the sensors hook it up with your cars and all those data once you have this data you will have the power to make interesting happen and Not only you will you want to track one car You also track want to track all the cars is on the same roads or all the cars are on every row Because you want your you want to tell your drivers that there's another car driving almost very close to you and about client and you need to take actions and Even if we have a matured the controllers and the artificial intelligence Algorithm we can send the command to to from a Drupal to Android and stop the car before they before the accident happens so If anyone has an another interesting ideas about this super car I invite them to there is a micro stand in the middle of this room and please join me So if anyone else have some questions Please let me know and this is QA section Please use the mic and this session is a recorded That mic is not recorded. So if you ask something, I probably will try to repeat Hi How many concurrent users a standard Drupal with services can support? I'm sorry. I didn't hear it clearly. How many users concurrent users? Yeah How many Android devices? Standard Drupal service can support. Sure. Well, it's it's not there's a no hard limit right, it's based on your your servers Are you using Apache using Android X? Are you doing a caching? You're doing a PC memcash How can you handle that much data? So it becomes the old performance and the scalability question How can you scale a Drupal website from from my experience the website that I built For the beer application I received 500,000 page views per 30 days another question, please Sure again, I mentioned this briefly before You have a HTML5 web apps and you can use a phone gap and titanium API to build something in between Not a hundred percent native apps it depends on what's your targeted audience and What's your budget and if you really want to build something like a supercar? I highly doubt it that you would use phone gap or titanium API because you need to have Absolute control over the hardware absolute control over the CPU Multi-threading the the OS semaphors So you cannot rely on some rely on something in the middle that builds something which is not optimized I'm just failing to understand like why what's the benefit for a let's say Ticket buying app doing it natively and then making or doing it as a web app And then making it as a native iOS and Android app. Sure. Oh, I'll answer that briefly the question was what's the benefit of? visits cost between HTML apps from Third-party build apps visits native apps and my answer is If you use a third-party apps to build simple application, it might be faster You you might use phone gap phone gap of titanium API once and you suddenly have apps available on Blackberry Android iPhone iOS and maybe other things. So It might be you if you're using those tools it might help you build things faster and the cost might be relatively lower This is a native apps if you if you want to build that Let's say again, I think we want to use a use graphic cards on the Android or on the native Mobile hardware you you want to have the optimized experience. You want to use the resources exactly the way you want it and so Cost of visits Quality sometimes you're welcome. So, you know, would you recommend building a separate mini Drupal site per app? Sorry, I didn't hear it. We'll recommend a separate mini Drupal site for each web app Separated Drupal Yes for the services module to Like would you have a mini Drupal site because I went to the other one where you know He's like adding questions and it creates nodes. It creates extra nodes Content in your site. So would it be more efficient to create a separate site a separate mini site to manage your web apps. I see manager Android apps well The question if I can put it into this way if you can build a one big site, do you want to build a few small sites? What if you build a one big site you have a one One big table of a user resources you can manage manage all those users using the standard Drupal management system and Things I can work maybe in a very simple way But if you have a different small size you want those sides talk to each other all those sides I mean when when they come out of a box, they don't know how to talk to each other. So you have to build some communication procedure or protocols among all those small sites and One benefit I can think of if you when building a separate site just for mobile is for scalability purpose or maybe of For example, you have if you have Drupal site and if you if you use a solar search engine you might want your you might want to your Mobile application talk to your losing us. Sorry solar solar directly instead of going through Drupal So in that case you have Drupal site and solar search engine which kind of function like a separate application But again if you want to build as many small size that you need to think about the cost of building them and making them work Which each other kind of a general question first Can you recommend any books that you've written or read that would be great resources for those of us here that Need to learn maybe the technical details and the overall infrastructure planning books for what for like For like technical details and implementation and then just the infrastructure planning to for Drupal or for Android I'd say kind of both Okay, I haven't read any books for Android it yet because I started doing Android in 2008 at that time there wasn't many books available But for Drupal for Drupal I have read I have read one book, which I think is really good But it's outdated. It was the Drupal 6 module developer development book written by Matt Butcher He used to work at a pen and tear but not anymore Okay, and then a very specific question for Android What's your best practice for dealing with images? I've made Android applications that try to base 64 the images and then they always crash on the phone with little memory Something you really don't have to deal with on the iOS That's why people don't like dealing with Android generally it's just because you don't know what you're gonna get with Android So what's the best practice for large files like images and transferring them and reading them in? Okay, so Android it has this app level garbage collector so and they recycle things For if you have big images and Because Android users can switch applications at any time and they want to switch back And the Android application will assume that you have some mechanism in place When and to display your content properly when the user switching back, so I I can't get into Very details, but I would say Android developer Website is your friend you want to look into the Looking into the documentation about the resources and recycling and app life cycles That will help you to make a better application Thanks So my question is on you were mentioning how Android apps could possibly Share resources and and data with each other And so I was wondering if you could kind of go into a little more detail with respect to the protocols Or the perhaps the client side it's hard to say service But you know that's basically what you would have is a client side service I would think that would enable would facilitate That kind of data sharing could you could you explain a little more about? Sure, I can explain briefly and I'll give you one example. So Drupal has many layers There are storage layer and the application application layer So you build something on your website if you build something on your website already it's up Accepted the presentation layer when I say presentation layer means HTML CSS JavaScript all those things will make your data will make your data look pretty and If you build the applications on Android, you don't need that the presentation layer You don't need a HTML 5 you don't need a CSS and a JavaScript in most cases if you build a native apps So you want to only reuse the workflow your users and the logic The actions or rules you only want to use this abstract data or resources and on your Android phone You recreate the app the presentation layer on the local device using the proper Language for Android they there they use an XML markup The one example I can give you is that for the application that I viewed a few years ago We're sharing the beer information all the beer information like a color ABV history brand information sales data all those data entered by different roles through the web Web portal by different people So the Android will just make a functional cause to the Drupal site and the Drupal will Transport in those data to the Android. So You actually on the application on the Android application You don't have that data available to the users at any all the time The application require internet connection. So every other time any time if you want to access those data You make as a services call Okay, so but I was when you were talking about how the life site the application life cycle on Android functions and you're going in and out of different applications. So Presumably I was assuming that meant that there were applications that you didn't write somebody else wrote another application you have two or more applications running on the on the Android platform from different authors and Then It sounded like you were suggesting that they could share data and so I was wondering About those protocols. Okay there. I'll give you two short examples. When is the barcode scanning? there's a Sorry, let me try to look at it the name Barcode scanner. So there's a barcode scanner module viewed by open source community available on Android So for my application, I don't I don't want to rebuild that I don't want to like to control the camera and do the upgrades So I just make a very simple API call saying hey Buckle the scanner come to scan this barcode and it tell me what the buckle mean and when the barcode Scanner module returns it give me a integer or text that I use this text send it back to Drupal for views query another thing is Vo it Google voice transcribe So when people drink a lot of beer they tentatively They cannot type Well, so I give them all the options to speak to the phone and the phone We are transcribed the beer name back now. I just send it to Google search and it will return the notes Okay, thank you. You're welcome When you were speaking about the supercar It sounded like most of the AI is distributed in the cloud. Yes, and it seems to me like for an application such as that Having sort of your head in the clouds Might might not always be the best case because what happens when it disconnects your connection So for that application specifically or anything like that Are you also building artificial intelligence locally and the Android device? My my session is it's focusing on What was the focusing on the? Artificial intelligence over the cloud. So your question was what happened if there's no internet connection. Well, that's the government's Responsibility government is responsible for making all those infrastructure run smoothly and making the internet action run As fast as they can so I guess I guess more to the point I'm wondering where we're at in terms of hardware to do complex AI like that on a native device In the actual native code without Distributed computing in a cloud and is it always going to make sense to use the cloud for that kind of an application Sure, you can all you can always build your artificial intelligence algorithm on local device But if you do that, there's something that interesting I will not happen because you Data and AI is on your local device, and it's just not communicated or connected You're welcome and for the heart sorry for the hardware a question you mentioned Arduino is an open source hardware, and you can make more like Circles or controllers on top of that framework. All right No more questions Be your time Thank you very much Sorry about that So every session has the survey link so you can access this survey link through the The website or you can scan the barcode and it will take you to the survey link. Thank you again