Following a week of pleasant surprises for BlackBerry (BBRY) and its investors, the Canadian cellphone pioneer said over this past weekend that it will start licensing its once-beloved name.

In 1999, the company was the first to endow a two-way pager with email capabilities. The release of this device, the BlackBerry 850, marked the birth of the smartphone market, and the company was the leader.

BlackBerry's devices were so addictive and popular that users lovingly referred to the brand as "CrackBerry." And celebrities -- as well as President Barack Obama -- helped to boost the device's sales.

As recently as 2013, 85 million people subscribed to BlackBerry's services worldwide. But already, the company's fortune was on the wane.

At its peak in July 2007, BlackBerry's stock was worth more than $240 a share. By December 2013, it was worth less than $6 a share.

Simply put, more sophisticated cellphones such as Apple's iPhone and devices using Alphabet's Android operating system pushed BlackBerry out of the market. And BlackBerry realized it had lost the battle in 2014, when the company took a $1 billion loss and laid off a large percentage of its workforce.

Apple and Alphabet are holdings in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. See how Cramer rates the stocks here. Want to be alerted before Cramer buys or sells AAPL and GOOGL? Learn more now.

Founder and then-Chief Executive Thorsten Heins was replaced by John Chen, an executive with experience in turning around struggling technology businesses.

By last year, BlackBerry had signaled that it would move away from the cellphone business, and this year the company said that it would stop making phones altogether.

Instead, BlackBerry is pushing for more lucrative opportunities in cybersecurity products, the Internet of Things and self-driving car software.

Already, the company has had more success. A partnership with Ford Motor helped the company get its foot in the door in the automotive-software industry, as well as line up contracts with other automakers.

And last week, BlackBerry said that it will open a facility in Ottawa, Canada, devoted to self-driving-vehicle research. This development, paired with better-than-expected third-quarter earnings, led investors to push BlackBerry's stock up on Tuesday.

Over the weekend came another announcement that is just icing on the cake. A few months ago, BlackBerry said that it would license its BlackBerry brand to Chinese electronics company TCL. 

But now the company has officially said that the next-generation BlackBerry phones will be unveiled at the 2017 Consumer Electronics Show next month. There is even a rumor that the phone will be a bit retro, with a QWERTY keyboard.

One thing is for certain, however. Unlike earlier BlackBerry phones, the new ones will work on an Android operating system.

BlackBerry has nothing to lose by letting someone else manufacture its branded phones. Apart from licensing revenue, the deal will help BlackBerry retain its once-beloved public profile.

Meanwhile, this stock is a great opportunity for long-term investors looking for a play on connected technology and self-driving cars. These areas are where the real gains for this company will be.

As the market for autonomous cars grows, BlackBerry will have been at the forefront. And its software will be in demand.

---

BlackBerry is a great long-term play for investors. But what if I told you I know a way you can see a $67,548 per year - or more - in profitable trades right away just by following this simple step-by-step process? The trader who is sharing this secret has been right more than 8 out of 10 times, turning $5,000 into more than $5 million for himself. Click here to see how easy it is to follow his lead and collect thousands of dollars in "Free Money" every month.

The author is an independent contributor who at the time of publication owned none of the stocks mentioned.