McDonald’s is aiming to make a difference in its future — seven seconds at a time.

The company that helped define fast food is making supersized efforts to reverse its fading popularity.

Expanding delivery. Putting digital ordering kiosks in restaurants. Rolling out an app that saves precious seconds. All are part of its plan.

Much of the work is on display inside an unmarked warehouse near the company’s headquarters in Oak Brook, where a blowup of a cellphone screen shows the app launching nationally later this year.

McDonald’s estimates it would take 10 seconds for a customer to tell an employee their order number from the app, down from the 17-second average of ordering at the drive-thru — a difference that could help ease backups there.

Elsewhere at the Innovation Center, the digital ordering kiosk shows how customers can skip lines at the register.

Brandon Alba of Milwaukee orders at a self-service kiosk at a McDonald’s restaurant in Chicago. | AP

“Five, 10 years ago, we were the dominant player in convenience, as convenience was defined in those days,” says Steve Easterbrook, McDonald’s chief executive officer. “But convenience continually gets redefined. And we haven’t modernized.”

The push come as McDonald’s Corp.’s stock has hit all-time highs, with a turnaround plan that’s included slashed costs and expansion overseas.

Yet, in its flagship U.S. market, it’s fighting intensifying competition, fickle tastes and a persistent junk-food image.

In an increasingly crowded field of places to eat, the number of McDonald’s locations in the United States is set to shrink for a third straight year. And at established locations, the frequency of customer visits has declined for four straight years — even after the launch of a popular “All-Day Breakfast” menu.

The chain that popularized innovations like drive-thrus in the 1970s acknowledges it has been slow to adapt.

Lots of once-dominant restaurant chains are feeling the pressure of people having more eating options. An estimated 613,000 places were selling either food or drink nationwide last year, up 17 percent from a decade earlier, according to government figures. Supermarkets and convenience stores are offering more prepared foods. And meal-kit delivery companies have been expanding.

“Better burger” places like Shake Shack don’t come close to McDonald’s roughly 14,000 U.S. locations, but they’re growing. And even if Starbucks and Dunkin Donuts don’t serve burgers and fries, they are among those promoting food more aggressively.

“They’re still taking customers from the same market pool,” says Nick Karavites, a McDonald’s franchisee with 22 locations in the Chicago area.

Richard Adams, a former McDonald’s franchisee who’s a consultant to those businesses, has questioned whether the chain can return to the height of its popularity, noting that many of the new offerings the company is pursuing, such as delivery, are already available at other places.

“They’re following the marketplace,” says Adams.

One main focus — as always with fast food — is the drive-thru, where McDonald’s gets roughly 70 percent of its business.

Customers who place orders on the mobile app, for instance, could also pull in to a designated parking spot where an employee would bring out their order. That should ease backups at the drive-thru, which, in turn, might prevent potential customers from driving past without stopping during peak hours.

Then, there’s the partnership with UberEats to offer delivery. McDonald’s gives an undisclosed percentage of the sale to UberEats, in addition to a fee of about $5 that customers pay. So a risk is that delivery could draw from in-store sales, eating into profitability.

So far, though, McDonald’s says delivery is bringing in new business during slower times at the roughly 3,500 locations where it has rolled out since the start of the year.

But such changes aren’t likely to transform operations overnight, since most of McDonald’s customers might prefer to order the way they always have.

“That’s like turning a very large ship,” says Karavites.

At his remodeled restaurant in Chicago where delivery was recently launched, sales already are climbing, he says.

To bring more people in over the short term, the company is promoting $1 soft drinks and $2 McCafe drinks. Glass cases displaying baked goods also are popping up in stores. And at about 700 locations, the company is testing “dessert stations” behind the counter where employees can make sundaes topped with cake or brownie chunks. Those stations eventually could handle an expanded menu of sweets.

Meanwhile, McDonald’s is still trying to shake its image for serving junk food, especially since its appeal to families with kids has long helped keep it ahead of rivals like Burger King and Wendy’s. It has made changes to its Happy Meal and made a high-profile pledge to offer healthier options. It plans to start using fresh beef instead of frozen patties in Quarter Pounders.

Silvia Ruiz prepares a specialty sandwich at a Chicago McDonald’s. The chain is still trying to shake its image for serving junk food and has made a high-profile pledge to offer healthier options. | AP