FORTUNE -- A week before Mark Zuckerberg announced the "Facebook phone," he spoke extensively to Fortune senior writer Jessi Hempel about how he's reinvented Facebook to address the huge audience of customers who access the social network on their smartphones. (The complete story of Facebook's reboot will appear in the April 29 issue of Fortune.) Here are edited excerpts of Hempel's sit-down with Facebook's 28-year-old CEO:
Fortune: Talk about the process of becoming a mobile-oriented company.
Zuckerberg: When the iPhone first came out, we built one of the first apps. It was called 320. The framework we built was really far ahead of everyone else. It was 2008 or so, and this design of Facebook (FB) was, you opened it up and there were all these icons inside of the app. At the time it wasn't clear the world was going to move to primarily iPhone and [Google's] Android. Blackberry (BBRY) was a really big thing, and it was still growing at the time. We knew Microsoft (MSFT) was going to do something with Windows. We thought … there were going to be maybe four or five different operating systems, so we should invest in a framework that can go across all of those. We spent a year building that out. We launched it.
Fortune: What timeframe was this?
Zuckerberg: By [about] the end of 2011 we were rolling it out. Within three or four months of that, we were like, "This is good, but it's never going to get us to the quality level we want." At that point we were kind of in a hole. We had been working on it for so long. And the world had progressed. People used the Facebook app a ton. More than 20% of the time that people spend on their phone and apps is in Facebook. So we were just kind of really behind in terms of the quality level we wanted to be providing.
Fortune: So how did you solve the problem?
Zuckerberg: I'd say most of last year was retooling the company to do mobile development, which is more than just rewriting the apps. The whole release process is different. With web, we just push code to our servers. It's the same exact thing as on desktop. Whereas if you want to release a [mobile] native app, we're going through this process of compiling all the code together and submitting it to Apple (AAPL) and these stores. The people who use the Facebook [app] have to download this ten-megabyte file. It's a different way of doing things.
MORE: How Facebook Home works
Fortune: That must make mistakes a lot bigger deal because it takes a lot longer to go in and fix things, right?
Zuckerberg: Right, you have to wait until the whole next release. I can't overstate how much we had to retool the whole company's development processes. It wasn't just a matter of, 'OK now we're going to rewrite the whole thing in [programming language] Objective-C.' It was like, if there was a bug, we have to wait a month to fix it. So you have to spend more time testing. We kind of got to this state by the end of last year where our apps on iOS and Android were relatively highly rated; but our goal was never just to offer the same experience just kind of rewritten [for mobile].
Fortune: What was the goal?
Zuckerberg: We also had a series of longer-term projects, which was what we thought Facebook should be on mobile. We're about to go into this third phase, which is on Android and, at some point, [Apple's] iOS. The experiences don't look like the desktop website that we spent the first five years of the company only developing without doing any mobile development. Everyone has been asking us for years are we going to build a phone? And we're like, "No we're not going to build a phone." And then everyone's like, "Well are you going to build an operating system?" And it's like, "No we're not going to do that either."
If you build a phone, and it goes well, it sells low tens of millions of units. I mean, we serve a billion people. So even if we built a phone and 30 million people bought it, which would be a wild success, that would be 3% of the people we serve. We are not going to totally rotate our company to build something that is only going to help out 3% of our people in a good case. The other kind of option is to build an app. We're obviously going to do that. We have an app, and it's on the vast majority of phones, and according to ComScore and these firms, more than 20% of time that is spent in an app is on Facebook. And then on top of that, more than half of the top-grossing apps in the app store are connected to Facebook. So it's also a platform. But it's not an operating system. It's not running code. It's a platform. It's deeper in the experience.
Our basic approach has been, let's figure out how rich of an experience we can build that spans not just building an app but gets as deep into the system as we want.
Fortune: How do you do that?
Zuckerberg: For iOS we've already begun doing that, and the way to do that for Apple is, you work with Apple. They really control the operating system; we have contact control, single sign in, the app store, events integration, all that. We have a really good relationship with Apple. Android is different because it's a much more open platform. It's this system where it's designed so that any app can plug into certain core pieces of functionality. We wanted to start off trying to rethink some of those core things. How could these be better if, instead of the current system you have, they were people-centric in all the themes that Facebook stands for.
So that kind of gets to what I want to show today. It's not a phone or an operating system, and the point of showing you on all of these different devices is that it runs on any Android devices that you want.
Fortune: I have to imagine that when Google (GOOG) developed Android as an open platform, they didn't mean for Facebook to do this.
Zuckerberg: I'm not sure how they're going to react. We're building this as software that you can download on to phones. One of the nits about Android is that the software [on each phone model] is a little different, so it took some work to make it work on every given phone. So to start, we are only going to support downloads on five or six phones. I think that Google has this opportunity in the next year or two to start doing the things that are way better than what can be done on iPhone through the openness of their platform. We'd love to offer this on iPhone, and we just can't today, and we will work with Apple to do the best experience that we can within what they want, but I think that a lot of people who really like Facebook -- and just judging from the numbers, people are spending a fifth of their time in phones on Facebook, that's a lot of people. This could really tip things in that direction. We'll have to see how it plays out.
Fortune: It's almost a year since Facebook's initial public offering. What do you want the world to know about how things have gone here post-IPO?
Zuckerberg: It's interesting. There are a lot of things that have happened at the same time, right? We made this transition to being a public company, and at the same time we made this transition to being a mobile company. And the transition to being a mobile company had probably 10 times the difference on the company that anything about being public had. The company has definitely changed in the last year, but I don't think it's because we are now public.
One of the management decisions I made at the end of 2011. I split the company into these different product groups. [Apps, infrastructure, etc.] And I said, "OK, we are going to take two years and make each of these things really world-class." The first thing everyone did was take a step back and say, "All right well, in infrastructure, what do we need to rebuild before we can build the thing we want to?" I think you need commitment and continuity for a longer period of time and probably way longer than two years, but I think two years is a minimum.
Fortune: How about Microsoft? Long been an important partner to you. I'm sure they'd love it more if you had four major platforms you were developing for ...
Zuckerberg: And we would love it, too. We would love it if Microsoft had more success with their operating system. I think that would be much healthier for the overall system.
Fortune: So … do you have big plans for China?
Zuckerberg: No (laughing).
Fortune: What's your challenge for this year? (Editor's note: Each year Zuckerberg embarks on a one-year challenge, in 2010 he learned Mandarin, last year he pledged to spend time each day programming.)
Zuckerberg: I'm meeting one new person outside of Facebook every day. Who doesn't work at Facebook. It's going well—I've done a bunch of things in the community and just tried to get broader exposure.
|Why casino workers hate Obamacare|
|Five predictions for the World Wide Web that were way, way, way off|
|Netflix faster on Comcast, following deal|
|Big Gay Ice Cream's business secrets|
|Social Security is the best deal|