apps, web development

Huawei’s HarmonyOS: A Guide To App Development

Smartphone industry giants like Apple and Google have been battling for operating system supremacy for two decades, but now we have new rivals entering the playing field. Released in September 2019, Huawei’s HarmonyOS is a new Android alternative OS designed to take smart technology (and the way we use it) to new heights.

But how did all of this come to be? Huawei devices used to run on the Android platform, built with the top Android app development languages and distributed through the Google Play Store. However, in 2019, under the new US government sanctions imposed on Chinese tech companies, Huawei lost the support of Google and its services.

This resulted in the rapid rollout of the Huawei HarmonyOS 2.0 in order to provide support for all Huawei devices and their users worldwide. Now, what does that mean for smartphone programming, app monetization, and dev teams? 

It means that there is a whole new world of opportunities.

This was a key topic at the 2021 Huawei Developer Conference, where the participants and keynote speakers addressed the future of Huawei, HarmonyOS, and the limitless possibilities that the new ecosystem brings.

Here’s what you need to know about HarmonyOS app development, every mobile app language you can use for development, and what all of that means for the future of the smart tech industry.

What Is HarmonyOS?

HarmonyOS (previously known as HongMeng OS) is Huawei’s internal operating system and an answer to Google and the rest of the world that the Chinese tech giant can stand on its own in this competitive industry. Apple and Google are no longer the only players here, but HarmonyOS is not just another platform for running apps – it’s a future-proof solution.


What does that mean? 


In a nutshell, future-proof means that HarmonyOS is designed to work seamlessly across a multitude of hardware platforms. We are talking about IoT devices, smart home tech, wearables, PCs and laptops, mobile and handheld devices, and of course, smartphones. 


The idea is that when you design a Huawei application for HarmonyOS, the platform will allow you to optimize the app to run on every other Huawei device with minimal effort. This is definitely a step in the right direction for Huawei, as the company remains resilient in the global market and continues to rise in popularity, market shares, and revenue – so innovation remains at the forefront of the brand’s strategy.


Before we move on to HarmonyOS app development, though, let’s talk about some of the benefits that this new OS brings to the table.

Anticipated Benefits of HarmonyOS

Being a comprehensive, cross-device ecosystem, HarmonyOS has rightfully built up a lot of hype in the smart tech community. But let’s separate the facts from the noise and some of the misconceptions. Here are the benefits of developing a Harmony app and how it stacks up with Android OS and iOS.
HarmonyOS vs. Android vs. iOS

Now that you have the pros and cons for each operating system, let’s talk about the languages you can use to develop your app source code for a HarmonyOS phone.

What Languages Do HarmonyOS Developers Use?

The new Huawei phone software might be unique in many ways, and it might present an exciting future for developers and consumers, but it runs on many of the same pillars as other platforms. In other words, developers can use a mobile app language they already know and love along with their favorite software development methodologies to develop HarmonyOS apps.


The following languages are the same ones you would use to develop Android apps.


Depending on who you ask, Java is an easy language to learn for Huawei apps and software development in general. This object-oriented, multi-paradigm language boasts a huge online community and has a gentle learning curve, making it great for beginner developers.


It’s good, then, that you can build Huawei phone software with relative ease by using this language. Probably the best thing about Java, though, is that it’s a cross-platform language, so when you build the app source code, you can easily transport it over to other OS platforms. 


Another support language for developing Huawei apps is, of course, JavaScript, which is also an industry standard nowadays for all developers and dev teams. If you’re a serious developer, you need to know JS and how to code for various platforms.


From developing an app for the Huawei HONOR smartphones and all the HarmonyOS devices, all the way to desktop applications for Windows, as well as Android and iOS apps – JS is used in all areas of software development. JS is fast and easy to use, and has great functionality to bring beautiful and performance-driven apps to life.


Being one of the foundational pillars of modern software development, C++ is the top language for a rising developer. What’s more, it’s an essential language to use for this new China mobile OS. 


The great thing about C++ is that the community support and learning documentation is vast. YOu can get into C++ programming quickly and use its portability features for easy cross-platform development. This is a multi-paradigm language as well, meaning that you can use the best programming style for every app type and project.

3 Steps to Building a HarmonyOS App

Fortunately for you and the companies choosing to do IT outsourcing to build a Harmony app, Huawei has mirrored and improved upon the success of Android Studio. The company has its proprietary development environment called DevEco, and it also offers numerous features and perks that allow developers to build, test, and roll out a Huawei application efficiently and effectively.


Here are the three key steps you need to take to build HarmonyOS apps.

Get familiar with Huawei DevEco studio

First things first, you will need to get acquainted with the DevEco studio, which will be your primary working environment for HarmonyOS app development. DevEco studio allows you to build apps the way they were meant to be built for Harmony, meaning that you can easily create corresponding code and projects for various devices.


These include:

  • Any HarmonyOS phone
  • Tablets
  • Vehicle head units
  • Vision products
  • Wearables
  • Lite wearables
  • Smart vision devices


You can use the studio’s intuitive project wizard to create project templates with several predefined abilities. 


The built-in abilities include:

  • Empty ability
  • Native C/C++
  • Lite empty ability
  • About ability
  • Category ability
  • Fullscreen ability


Of course, you can always get more project templates on Huawei’s Template Market. Different templates support different devices and a different Huawei programming language. 


DevEco is an intuitive system with many efficient device software features, so it will automatically generate sample code and a resource template to let you start working quickly. You can also adapt a history project to a new API version, which is necessary if you want to open your project in a new HarmonyOS SDK.


It’s also important to note that the HarmonyOS software development kit allows you to import sample projects quickly through the Gitee open-source community. You can add or delete modules and classify them as abilities or libraries containing various source codes, resource files, third-party libraries, and app configuration files.


All of this makes your life a lot easier, as you only need to search for and implement these features within the DevEco studio.


Don’t forget to leverage the Huawei HarmonyOS archive feature, which can give you access to source code, resource files, HarmonyOS configuration files, and third-party libraries. You can only reference the archive package by phone, tablet, car, TV, and wearable projects.


Okay, let’s move on to the actual HarmonyOS app development process.

Develop service functionality

DevEco aims to simplify developing service functionality for a Harmony app as much as possible. You’ll notice that the SDK will provide you with an intuitive editor that will make smart suggestions to make your life easier, so use it to create your app source code and the application itself much faster.


The latest versions of the SDK allow for more efficient and smarter low-code development as well, and you can also work on cross-device code editing seamlessly within the tool. It’s possible to preview your app during the development process as well.


After you have set the project and modules, you can move on to source code development. It’s important to note that DevEco provides you with a Java code obfuscation feature. This feature will rename the Java code in your project to meaningless designations to reduce the size of your HarmonyOS apps, but most importantly, protect it against data leakage and minimize security risks.


You can then proceed to build your code without any risks or security threats. Remember to run your app in the built-in emulator for continuous testing, which is available in DevEco Studio 3.0 Beta and later versions. 

Crawl your code for errors & deploy your app

Debugging your app before the release is an essential step for any serious developer, and the DevEco Studio allows you to do just that with its pre-build features. The great thing about this SDK is that it offers debugging visualization for C++, Java, and JS. You get a visual representation of your current value in a tree diagram, a line chart, a bar chart, or a table chart.


You can also visualize value changes and variables to identify and spot bugs quickly. Developing Huawei apps is also way more efficient now that you can run cross-language and cross-device debugging within the DevEco Studio.


When using more than one mobile app language in this SDK, you can easily run Java and JS cross-language debugging or Java and C++ debugging. Likewise, you can also use the studio to connect one project to multiple devices, see how it would perform, and run the debugging process. 

Can HarmonyOS Host Android Apps?

Yes and no.


Any Android-alternative OS will have certain compatibility issues, so some apps will work, and some won’t. Concretely, only the apps that do not rely on the Google Mobile Services functionality will run on a HarmonyOS phone or other devices. This is because Huawei is no longer supported by Google services.


If the app relies on Google’s services, and you want it to run on Huawei phone software, you will need to convert your Android app to HarmonyOS. When you do, you will effectively be able to market your app on Huawei’s AppGalery as well. 


Here’s how to convert it.

How to convert your Android app to HarmonyOS

If you are looking for a quick and easy way to port your Android app to HarmonyOS, you might feel a little sting of disappointment. Currently, there’s no way to do it.


Huawei is heavily encouraging developers to build apps that are native to their new operating system. But even though the DevEco Studio has many wonderful features, it doesn’t have an Android-Harmony conversion toolkit. You will need to build the same app from scratch, sorry.


That said, keep in mind that Huawei is hard at work to make this feature a reality, so you can expect it to become available in a future update. While it’s not yet known when this update will be released, it’s good to see that it’s in development.


On the other hand, remember that you can import your source code into the DevEco Studio, so you’re never really starting from scratch.

Source Code for Harmony from Github

Every developer knows that Github is a treasure trove of knowledge in the IT community and the best real-time collaboration platform on the web. This is the place you go to when you want to find guidance and support, work on your code and projects with others, and of course, find source code for your work.


There are many resources on this platform, like this one, that can help you get started, troubleshoot common issues, and find the code you need to develop your app faster. It’s a vast online community, so make sure to use Github to accelerate your Harmony OS app development moving forward.


Developing HarmonyOS apps is a lucrative opportunity for individual software developers and companies to fill a new demand in the smart tech industry. As smart devices become more connected and as Huawei continues to push for a more synergistic user experience across multiple device platforms, it becomes more important to code apps for this new, comprehensive OS.


In the years to come, Huawei’s OS will continue to rise in popularity and adoption rates as customers continue to purchase their quality devices and equipment. They’ll expect to get new apps that they can use seamlessly on every device, so make sure to get into HarmonyOS app development in order to capitalize on the new opportunities in this rising market.