What does it take to build a profitable app? For Danish app-maker Endomondo, the formula involved adapting to new technologies, obsessively monitoring reviews, making connections at Apple and Blackberry, and--eventually--scaling to 20 million users.

Endomondo bills itself as a "sports community based on real-time GPS tracking of running, cycling and so on." But really it's an app for fitness buffs to monitor their runs or bike rides, share stats, and compete with their friends. Endomondo is available on most mobile platforms in free version and paid subscriptions ($2.99 per month; $19.99 per year). There are other editions tailored to calorie counting ($0.99), interval training ($1.99), and timing ($0.99). 

On Thursday, the company announced it was finally profitable, though as CEO Mette Lykke tells Inc., the process was hardly painless. 

Lykke launched her business in 2007, with the vision of bringing a social component to individual-minded sports like running and swimming. She quickly spotted two issues: GPS-enabled phones weren't mainstream and with few users to begin with, the social component was bound to fall short. 

“We knew early on that we wanted to make a social community, but we also realized we needed something else as the foundation,” says Lykke. So to attract more users, her team built a separate feature that would function “like a personal trainer in your pocket." As users worked out, the app would provide audio feedback, offering stats such as calories burned or miles left to run. Eventually, the capacity to race friends and compete against previous workouts was added, making the app highly interactive. 

Though her company was based in Denmark, Lykke made sure the app was all done in English to attract more American users. "That's the beauty of being in a tiny country," she says. "You know the only way to expand your userbase is thinking broadly." 

While those strategies bolstered its user numbers, Lykke was growing concerned that the company still wasn't profitable. Two years in, she only had a few hundred thousand users to show for it, hardly enough to keep the business afloat.

As she later discovered, the solution would be to convince popular app stores to feature her product. Lykke sent letters explaining how Endomondo worked and why users adored the app. (Some had told her it changed their life.) More importantly it had a good ratings in the app stores (four or five stars out of five), a strong indication the product was solid. 

To Lykke's delight (and that of a very supportive investor), Endomondo was featured in BlackBerry, Android, and Apple's app stores, and its user base increased exponentially. “When we were first featured by BlackBerry, the rate of user downloads on those devices increased 42 times,” she says. She declined to give numbers for Apple.

Being featured in the app stores was helpful, but in the end, having a good product was what convinced people to buy, stresses Lykke. To ensure that the app kept its high rating in stores, she listened intently to users and made it a point to personally respond to requests and complaints. To this day, many of the new features come from user suggestions. 

Also helpful in turning Endomondo profitable was the fact that many fans liked sharing their workouts on Facebook. Obviously, "there were certain trends we had to wait for," says Lykke, but since so much of the app is social, users quickly discovered that the way to truly enjoy it was with friends. 

Now that Endomondo is profitable, Lykke is staying focused on fueling growth. "It does take a lot more users than we expected in the beginning," she says, "and everything is going so fast. Unless you have a very expensive product, you really need a lot of users, millions of users. The ads are not going to take you very far unless you are Facebook." 

To that end, Endomondo plans to tweak its "classic freemium model" by expanding its paid version into more of a full-fledged personal trainer that requires a monthly subscription. "We personalize the program depending on your input," says Lykke. 

When asked if she do anything differently next time, Lykke can only laugh. “I would have done smaller things differently,” she says. “But it’s never going to be a straight trip from point A to point B. It’s always going to be a journey where you meet some closed doors or walk into some dumps. That’s what makes it sort of fun.”