New York CNN Business  — 

BlackBerry may no longer be a leader in the smartphone market. But the company’s shift to software for autonomous vehicles and cybersecurity is paying off.

BlackBerry (BB) reported earnings and sales Thursday that topped Wall Street’s forecasts, led by strength in its tech solutions and licensing businesses. The stock was up nearly 2% on the news, a sharp contrast to the rest of the market.

CNN Business spoke to BlackBerry CEO John Chen about the latest results. Chen said that the company’s focus on the connected cars market in particular is helping sales.

Chen said sales from its connected cars business grew 23% compared to a year ago. BlackBerry has developed self-driving car technology as well as infotainment software (music, maps, etc.) through its QNX unit.

The company has struck deals with big auto manufacturers like Ford (F) and Hyundai (HYMTF), global auto suppliers Aptiv and Denso, and tech giants such as Chinese search engine firm Baidu (BIDU).

Making autonomous cars safer from cyberthreats

BlackBerry has also become a big player in cybersecurity over the past few years, and the company just agreed last month to buy Cylance, a firm that specializes in using artificial intelligence to monitor and prevent cyberattacks, for $1.4 billion.

Chen said that the Cylance acquisition will bolster its autos business by helping to make connected cars safer from viruses and malware.

Still, Chen acknowledges that there is more work to be done at BlackBerry in order to get the company back on track. The stock is down more than 30% this year despite Thursday’s rally.

Chen, who joined BlackBerry in late 2013 and recently announced a new deal that will keep him as CEO though 2023, said he wants “consistent growth” now that BlackBerry is no longer making its own phones.

BlackBerry was once the phone of choice for Wall Street traders, politicians and celebrities. President Barack Obama was often spotted with a BlackBerry. So was Kim Kardashian West.

But the company was too late to the touchscreen game, and customers left in droves for Apple’s (AAPL) iPhone, Samsung’s (SSNLF) Galaxy and other devices running on Google’s (GOOGL) Android system.

It will take time before the shift away from hardware yields solid overall growth for the company. Despite the big surge in services and licensing revenue, BlackBerry’s total sales were still flat when compared to a year ago.

“We’re working off the legacy revenue,” Chen said. “Now we want year-over-year growth. Sales are flat now as opposed to declining. But the focus is on building a dependable growth engine.”