DEV Community

在人间耕耘
在人间耕耘

Posted on

Jump to App Market Feature Development Notes

Jump to App Market Feature Development Notes

About HarmonyOS 5

HarmonyOS 5 (also known as HarmonyOS Next) represents a revolutionary step in the evolution of Huawei's distributed operating system. As someone who has been following its development closely, I can attest to the remarkable improvements in this version. The system's microkernel architecture not only enhances security but also provides unprecedented flexibility in cross-device collaboration. What excites me most about HarmonyOS 5 is its focus on developer experience—the new ArkTS language, enhanced UI components, and improved debugging tools have made development much more efficient. The distributed capabilities allow us to create truly seamless experiences across different devices, from smartphones to tablets, smart TVs, and IoT devices.

About the Author

I am a dedicated HarmonyOS developer based in China, with over three years of experience in the ecosystem. My journey with HarmonyOS began with its early versions, and I've witnessed its remarkable evolution. As a developer who has contributed to several open-source HarmonyOS projects, I've gained valuable insights into its architecture and best practices. I'm particularly passionate about user experience, feature integration, and cross-app interaction, and I enjoy sharing my experiences through blogs and open-source contributions to help more developers embrace the HarmonyOS ecosystem.

Preface

Recently, while developing HarmonyOS applications, I found that users often need to quickly jump to the app market for legal consultation. To improve user experience, I decided to develop a legal consultation module that allows users to quickly access related apps. Here I share my development insights.

I. Feature Description

The main features of this module are as follows:

  • Provide an entry for legal consultation
  • Support jumping to the app market
  • Support favorites functionality
  • Provide user feedback

II. Implementation Process

1. Jump to App Market

// Example: Jump to App Market
jumpToLegalApp() {
  let want: Want = {
    action: 'ohos.want.action.appdetail',
    uri: 'store://appgallery.huawei.com/app/detail?id=zy.zhenlvfalvzixun.law',
  };
  const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
  context.startAbility(want).then(() => {
    promptAction.showToast({ message: 'Redirecting to App Store...' });
  }).catch((error: BusinessError) => {
    console.error('Jump failed:', error);
    promptAction.showToast({ message: 'Jump failed, please try again later' });
  });
}
Enter fullscreen mode Exit fullscreen mode

2. The Awkward Moment of the Favorites Feature

Another time, a user said the favorites feature didn't work well. At first, I felt wronged: "Isn't this simple?" But after trying it myself, I realized there was indeed a problem. The most awkward part was that there was no prompt when favoriting, and sometimes it failed. The user said, "I tried to favorite for a long time, but didn't know if it succeeded. So annoying!" I quickly revised it several times and added a success prompt. Now, thinking back, I'm grateful for that user's feedback—otherwise, I wouldn't have noticed the issue.

// Example: Favorites feature
async toggleFavorite() {
  try {
    if (this.isFavorite) {
      await StorageUtil.removeFavorite('legalAdvice');
      promptAction.showToast({ message: 'Removed from favorites' });
    } else {
      await StorageUtil.addFavorite({
        id: 'legalAdvice',
        name: 'Legal Consultation',
        path: 'pages/Legaladvice/Legaladvice',
        icon: '🤝',
        timestamp: Date.now()
      });
      promptAction.showToast({ message: 'Added to favorites' });
    }
    this.isFavorite = !this.isFavorite;
  } catch (err) {
    console.error('Favorites operation failed:', err);
  }
}
Enter fullscreen mode Exit fullscreen mode

III. Usage Scenarios

  1. Quick Consultation: Users can quickly jump to the app market for legal consultation by clicking a button.
  2. Favorites Feature: Users can favorite frequently used legal consultation entries for quick access next time.
  3. User Feedback: Prompt messages let users know the result of their actions.

IV. Pitfalls and Issues

  1. Sometimes there are permission issues when jumping to the app market (sometimes an error pops up unexpectedly, really frustrating)
  2. Sometimes popups don't appear when using the favorites feature, which is annoying
  3. Sometimes strange errors pop up during user feedback, really frustrating

V. Summary

This legal consultation module covers all the basics:

  • Supports jumping to the app market
  • Supports favorites feature
  • Provides user feedback

To be honest, developing this module was a love-hate process. I loved seeing it grow from nothing to something useful, but hated all the pitfalls along the way. Looking back, those pitfalls were worth it! Without them, I wouldn't have found so many areas to optimize.

Some edge cases are still not fully resolved, such as occasional slow jumps or UI stutter when favoriting (and sometimes strange errors pop up, which is really frustrating). But it works for most scenarios, and user feedback has been positive. I'll keep optimizing as time allows—after all, good products are polished over time.

VI. Reference Resources

Welcome to Experience

This legal consultation module has been integrated into the HarmonyOS Developer Toolbox. Welcome to download and experience it!

HarmonyOS Developer Toolbox

If you are also developing HarmonyOS apps, feel free to use this module—I hope it helps you!

Author Information

Author: In the World of Development
Email: 1743914721@qq.com
Copyright Notice: This article is an original work by the CSDN blogger, please include the original source link and this statement when reprinting.

Top comments (0)