👨🏼‍💻Harmony OS vs. Android: Common method alternatives

Sabrina Cara
Huawei Developers
Published in
4 min readMar 28, 2022
Source: https://www.gearrice.com/update/huawei-harmonyos-vs-android-which-is-better/

Hello my friends, at last we meet again and this time with a new article on the best way to navigate through the differences between Android OS and Harmony OS as well as the alternatives of Harmony OS for some very common Android methods.

Introduction

With the popularity of the Harmony OS increasing on a daily basis, more and more developers are interested in developing apps in Harmony OS as well as ‘converting’ third party Android libraries into Harmony OS libraries. This is a tedious job, and it becomes particularly difficult when you do not know Harmony’s alternative to a certain Android method or feature. In this article, we aim to clarify some of these commonly used methods of Android and the alternatives of them in Harmony OS.

What is Android OS?

Android OS is a mobile operating system based upon Linux’s kernel and other open source software, designed primarily for touchscreen devices such as smartphones and / or tablets. It is widely spread among many devices and it currently offers a variety of features and methods.

What is Harmony OS?

Harmony OS is Huawei’s newest operation system, aiming to enable seamless interactions among various devices operating on this OS. This is achieved by creating a hardware synergy for resource sharing. Harmony OS has been developed by taking Android as a reference, however it is not dependent on Android, hence it does not recognize its methods and functionalities.

In order to compare the different methods that exist in both operating systems, I have taken into consideration various fields of operation. We will be comparing the methods in these two operating systems by taking into account the package names, the method names and the fields of use for each.

Common Methods and Alternatives

Before I go ahead and show you the comparison table where all the different methods taken into account are presented, I would like to quickly mention the main categories these methods belong to and why they might be important.

  • Application Information and Basic Methods

Some of the very basic methods we use every time we are trying to develop something in Android are methods such as :

— Application Info, displaying information about the application, collected in the application section of the Manifest / config file.

— Context, the interface of global environment information about the application environment.

— Environment, providing access to environment variables.

— Views , representing the basic building block for user interface components and

  • Image and graphics related methods

— Paint and Path, representing drawings on geometries, geometric paths, styles and colors of them etc.

— ImageView, representing the block that displays an image resource

  • Operating Systems and Threads methods

— Handlers, scheduling messages to run at some time in the future or to be performed asynchronously in another thread.

— Loopers, needed to run a message loop in a thread

— Message, containing the necessary information and data to be sent to the aforementioned Handler.

— MessageQueue, representing the queue of messages that are being stored to be dispatched at a later time by the Looper.

The detailed comparison of these simple methods I just explained, is presented below.

Comparison Table

There are many more methods that need an alternative in Harmony, however in this article we have focused only of these widely used ones. Other methods are to be explained in the upcoming articles. Until then, enjoy and feel free to contact me in case you are struggling with a method alternative in Harmony OS.

Conclusion

Once again we have reached the end of the article friends. Due to the increasing popularity of Huawei’s new operating system, Harmony OS, more and more developers are trying to get their first hand experience with Harmony OS’ features and methods. However this becomes hard when they do not know what services to use in a particular situation. In this article we have discussed some methods widely used in Android OS and their alternatives in Harmony OS, in an attempts to make things easier for developers trying to navigate through the differences among the two. Until next time, au revoir my friends.

References

--

--

Sabrina Cara
Huawei Developers

Android Developer at Huawei, HMS and Android enthusiast.