Many are worried about the long-term viability of BlackBerry given its shrinking market share. Of course, Research in Motion is still making money and selling lots of phones. But the competition from iPhone and Android is intense, and it has to do something to be seen as a “next gen” smartphone supplier if it wants to regain its luster.

In fact, the venerable BlackBerry is currently in a “tweener” stage. The existing generation of devices and the OS that powers them is getting old. RIM is significantly revamping the BlackBerry OS through a new kernel (QNX, first seen on its PlayBook tablet) and a new user interface, and integrating a number of other technologies it has been on a tear to acquire over the past 1-2 years (e.g., Torch Browser, extending BES to manage iPhone and Android devices, in-app monetization, social media extensions, push notifications, location-based services, and more.).

The complete transformation will take 1 to 2 years, but the initial fruits of RIM’s labors are being demonstrated with the current PlayBook OS, a version of which will soon make its way down into the smartphone category. But it isn’t clear if users will stay loyal until the new phone OS is out late this year or early next year. The question many are asking, is this too little too late? What if BlackBerry OS Next doesn’t take off? What if the PlayBook isn’t popular? As it turns out, we believe RIM has a backup plan. And it could prove to be a real winner.

QNX gives RIM a strategic advantage as a high performance and highly adaptable real-time operating system. What if BlackBerry devices (and PlayBooks) could have multiple OS boot capability? Image a BlackBerry device running Android better than Samsung, Motorola, et al!  And imagine it does it with complete security and manageability. That’s what RIM could actually do on its devices and has already hinted at doing with its Android app player. QNX gives RIM that capability and more.

If you replace the kernel in Android with QNX Neutrino (a Posix compliant OS that could replace the Linux kernel in Android), what you have is a compatible Android platform that exceeds the performance of vanilla Android, and adds a host of features not available in Android (e.g., security, full DRM, app segmentation (Balance), BlackBerry Messenger, etc.). That could put RIM in the position of running the best Android on the market. So, as Android picks up steam, this could be a safety net if RIM can’t make BlackBerry the best of the best. It could also use this capability to leverage the sales of BlackBerry (and PlayBook) devices, letting people know they can easily run all the Android apps they want (just like Apple leverages running Windows apps on its Mac OS PC platform). Cleary Android version compatibility will still be an issue (e.g., Froyo, Gingerbread, Honeycomb), but no more so than with any other devices already in the market

To be sure, this is not RIM’s preferred outcome. It would much rather control its ecosystem as it has done in the past (and which Apple in particular does incredibly well). But most people would acknowledge that RIM makes some excellent hardware. If it can’t generate renewed excitement with its user experience, perhaps Android’s growing popularity could (in conjunction with BlackBerry services running on top or inside). At the very least, running in dual-boot mode (both BB OS and Android OS) could open the BlackBerry to a growing array of apps which it may not be able to attract to its own platform. And RIM would still make lots of profits in the extended services beyond vanilla Android it could offer users.

So, RIM could have the best of both worlds. It will revamp its BlackBerry OS, but if that doesn’t become popular (or become popular enough fast enough) it has the option of enabling users to deploy Android apps. And this might even prove highly popular with business users who would like to bring their own devices to work for the availability of apps, but also with IT departments who need to secure and manage them, thus enabling a win-win strategy.

Bottom line: Not a bad strategy (both defensively and offensively) if RIM can pull it off! We think they can. And it puts them in a lower risk position than Nokia with its “all its eggs in one basket” position, and ahead of the largely undifferentiated and no real value added Android-clones from many Far East suppliers. Don’t count RIM down and out just yet!

Jack Gold is the founder and principal analyst at J.Gold Associates, based in Northborough, Mass. He covers the many aspects of business and consumer computing and emerging technologies.