<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Baristuzemenn on Medium]]></title>
        <description><![CDATA[Stories by Baristuzemenn on Medium]]></description>
        <link>https://medium.com/@baristuzemenn?source=rss-6ad02bd0dcc6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fat2I1QdU7ZDZ65ZS1fpPQ.jpeg</url>
            <title>Stories by Baristuzemenn on Medium</title>
            <link>https://medium.com/@baristuzemenn?source=rss-6ad02bd0dcc6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 22:15:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@baristuzemenn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering Custom Drag Previews & UnifiedDataChannel]]></title>
            <link>https://medium.com/huawei-developers/mastering-custom-drag-previews-unifieddatachannel-05ab6a6b3220?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/05ab6a6b3220</guid>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[ark-ui]]></category>
            <category><![CDATA[wearables]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 07:37:49 GMT</pubDate>
            <atom:updated>2025-12-25T07:37:49.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JaoG2MNeHR0jltvd-9oRTg.png" /><figcaption>Generated with AI</figcaption></figure><h3>Introduction</h3><p>When building for wearables, screen real estate is the most expensive asset we have. You can’t clutter the UI with buttons; you need intuitive gestures. That’s where <strong>Drag and Drop</strong> shines.</p><p>However, the default drag interactions often feel a bit… stock. Today, we’re going to push the boundaries on HarmonyOS. We will implement a drag interaction that uses a <strong>Custom UI Preview</strong> (instead of a generic shadow) and transfers data securely using the <strong>UnifiedDataChannel</strong> standard.</p><p>The goal: A snappy interaction where a user drags a button, sees a custom “badge” following their finger, and drops it into a target zone that visually reacts to the hovering event.</p><h3>Why UnifiedDataChannel?</h3><p>You might be tempted to just use global variables to move data around, but on HarmonyOS, the <strong><em>@kit.ArkData</em></strong> <strong>Unified Data Channel</strong> is the gold standard. It creates a standardized container (<strong><em>UnifiedData</em></strong>) that the system understands. Whether you are moving PlainText, images, or files, this ensures your data transfer is secure and compatible with the OS drag controller.</p><p>Coupled with ArkUI’s <strong><em>dragController</em></strong>, we can orchestrate the entire lifecycle: from the moment the finger touches the screen to the final drop.</p><h3>The Implementation Strategy</h3><p>We can break this down into three logical phases:</p><ol><li><strong>State &amp; UI Prep:</strong> Setting up reactive variables and the custom visual builder.</li><li><strong>The Drag Source:</strong> Initiating the drag and packing the <strong><em>PlainText</em></strong>.</li><li><strong>The Drop Target:</strong> Handling visual feedback (<strong><em>onDragEnter</em></strong>) and unpacking the data (<strong><em>onDrop</em></strong>).</li></ol><h4>1. The Setup: Custom Preview</h4><p>Standard drag shadows are boring. We want context. We’ll use a <strong><em>@Builder</em></strong> function to define a specific UI—in this case, a rounded blue badge with an emoji—that will follow the user&#39;s finger.</p><h4>2. The Trigger: Making it Snappy</h4><p>UX Tip: Don’t wait for a long press if you don’t have to. We trigger the drag inside the <strong><em>onTouch </em></strong>event specifically on <strong><em>TouchType.down</em></strong>. This makes the interaction feel instant.</p><p>We wrap our string data into a <strong><em>PlainText</em></strong> object, then wrap <em>that</em> into UnifiedData, and pass it to <strong><em>executeDrag</em></strong>.</p><h4>3. The Landing: Visual Feedback</h4><p>A drop zone must communicate availability. When the user drags over our target box (<strong>onDragEnter</strong>), we scale it up and change the border color. We also attempt to animate the drag preview itself (changing its color to green) to signal &quot;You can drop this here.&quot;</p><h3>Code Example</h3><p>Here is the complete, working implementation. I’ve included <strong><em>hilog</em></strong> for proper debugging because, let’s be honest, drag operations can be tricky to debug without logs.</p><pre>import { dragController, curves, UIContext } from &#39;@kit.ArkUI&#39;;<br>import { unifiedDataChannel } from &#39;@kit.ArkData&#39;;<br>import { hilog } from &#39;@kit.PerformanceAnalysisKit&#39;;<br>import type { BusinessError } from &#39;@kit.BasicServicesKit&#39;;<br><br>@Entry<br>@Component<br>struct Index {<br>  // Reactive UI State<br>  @State private dropText: string = &#39;Drop here&#39;;<br>  @State private dragLabel: string = &#39;Hello from drag!&#39;;<br>  @State private isDragging: boolean = false;<br>  @State private dropScale: number = 1.0;<br>  @State private dropBorder: ResourceColor = &#39;#111827&#39;;<br><br>  private readonly watchSize: string = &#39;100%&#39;;<br><br>  // Custom Preview: The UI that follows your finger<br>  @Builder DragPreviewBuilder() {<br>    Column() {<br>      Text(&#39;📦&#39;).fontSize(22).textAlign(TextAlign.Center).margin({ bottom: 4 })<br>      Text(this.dragLabel)<br>        .fontColor(Color.White).fontSize(16).fontWeight(FontWeight.Bold)<br>        .textAlign(TextAlign.Center).maxLines(2).lineHeight(20)<br>    }<br>    .width(150).height(90).borderRadius(16).backgroundColor(&#39;#2563EB&#39;)<br>    .justifyContent(FlexAlign.Center).alignItems(HorizontalAlign.Center)<br>    .padding({ left: 10, right: 10 })<br>    .shadow({ radius: 16, color: &#39;#33000000&#39;, offsetX: 0, offsetY: 2 })<br>  }<br><br>  // Logic to kick off the drag event<br>  private startDrag(pointerId: number = 0): void {<br>    // 1. Pack the data (PlainText)<br>    const txt = new unifiedDataChannel.PlainText();<br>    txt.textContent = this.dragLabel;<br>    txt.abstract = &#39;demo&#39;;<br>    <br>    // 2. Wrap it in UnifiedData<br>    const unified = new unifiedDataChannel.UnifiedData(txt);<br><br>    const info: dragController.DragInfo = { pointerId, data: unified, extraParams: &#39;&#39; };<br>    this.isDragging = true;<br><br>    try {<br>      // 3. Execute drag with the custom builder<br>      this.getUIContext().getDragController().executeDrag(<br>        () =&gt; { this.DragPreviewBuilder(); },<br>        info,<br>        (err: BusinessError | undefined, res) =&gt; {<br>          this.isDragging = false; // Reset state<br>          if (err) {<br>            hilog.error(0x0000, &#39;drag&#39;, `executeDrag error: ${err.message}`);<br>            return;<br>          }<br>          if (res?.event) {<br>            const ok = res.event.getResult() === DragResult.DRAG_SUCCESSFUL;<br>            hilog.info(0x0000, &#39;drag&#39;, ok ? &#39;SUCCESS&#39; : &#39;FAILED&#39;);<br>          }<br>        }<br>      );<br>    } catch (e) {<br>      this.isDragging = false;<br>      hilog.error(0x0000, &#39;drag&#39;, `executeDrag threw: ${String(e)}`);<br>    }<br>  }<br><br>  build() {<br>    Stack() {<br>      // Background (Watch style)<br>      Column() {}<br>        .width(this.watchSize).height(this.watchSize)<br>        .clip(Circle({ width: &#39;100%&#39;, height: &#39;100%&#39; }))<br>        .backgroundColor(&#39;#0B1220&#39;)<br><br>      Column() {<br>        // DRAG SOURCE<br>        Button(&#39;Drag Me&#39;)<br>          .type(ButtonType.Capsule).fontSize(12).height(36)<br>          .margin({ top: 8, bottom: 8 }).backgroundColor(&#39;#2563EB&#39;)<br>          .fontColor(Color.White).opacity(this.isDragging ? 0.9 : 1)<br>          .shadow({ radius: 12, color: &#39;#26000000&#39;, offsetX: 0, offsetY: 2 })<br>          .onClick(() =&gt; { this.dragLabel = &#39;Hello from drag!&#39;; })<br>          .onTouch((ev?: TouchEvent) =&gt; {<br>            if (!ev) return;<br>            // Trigger on &#39;Down&#39; for instant response<br>            if (ev.type === TouchType.Down) this.startDrag(0);<br>          })<br><br>        // DROP TARGET<br>        Column() {<br>          Text(this.dropText)<br>            .fontSize(14).textAlign(TextAlign.Center).fontColor(Color.White)<br>            .width(&#39;100%&#39;).maxLines(2).lineHeight(18)<br>            .padding({ left: 6, right: 6 })<br>        }<br>        .width(180).height(92).borderRadius(20).backgroundColor(&#39;#111827&#39;)<br>        .border({ color: this.dropBorder, width: 1 })<br>        .scale({ x: this.dropScale, y: this.dropScale }) // Visual feedback<br>        .justifyContent(FlexAlign.Center).alignItems(HorizontalAlign.Center)<br>        // Hover Enter<br>        .onDragEnter(() =&gt; {<br>          this.dropScale = 1.05; <br>          this.dropBorder = &#39;#22C55E&#39;; // Green border<br>          <br>          // Optional: Animate the preview itself<br>          try {<br>            const ui: UIContext = this.getUIContext();<br>            const preview = ui.getDragController().getDragPreview();<br>            const anim: dragController.AnimationOptions = {<br>              duration: 250,<br>              curve: curves.cubicBezierCurve(0.2, 0, 0, 1)<br>            };<br>            preview.animate(anim, () =&gt; { preview.setForegroundColor(Color.Green); });<br>          } catch (err) {<br>            const e = err as BusinessError;<br>            hilog.error(0x0000, &#39;preview&#39;, `animate error: ${e?.code}`);<br>          }<br>        })<br>        // Hover Leave<br>        .onDragLeave(() =&gt; { <br>          this.dropScale = 1.0; <br>          this.dropBorder = &#39;#111827&#39;; <br>        })<br>        // Drop<br>        .onDrop((dragEvent?: DragEvent) =&gt; {<br>          this.dropScale = 1.0; <br>          this.dropBorder = &#39;#111827&#39;;<br>          <br>          if (!dragEvent) return;<br>          const records = dragEvent.getData().getRecords();<br>          if (records.length &gt; 0) {<br>            // Extract the PlainText<br>            const first = records[0] as unifiedDataChannel.PlainText;<br>            this.dropText = first.textContent ?? &#39;dropped&#39;;<br>          }<br>        })<br><br>        Text(&#39;Tip: Press “Drag”, move the 📦 preview, and drop it into the box.&#39;)<br>          .fontSize(10).fontColor(&#39;#94A3B8&#39;).margin({ top: 8 }).opacity(0.9)<br>      }<br>      .width(&#39;70%&#39;).height(&#39;100%&#39;)<br>      .justifyContent(FlexAlign.Center).alignItems(HorizontalAlign.Center)<br>      .padding(8)<br>    }<br>    .width(&#39;100%&#39;).height(&#39;100%&#39;).align(Alignment.Center)<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*v1cEjuGIrA8hwRrarevnYw.png" /><figcaption>Wearable Screenshot Mockup</figcaption></figure><h3>Developer Notes</h3><p>A few things I learned while implementing this that might save you some headaches:</p><ol><li><strong>Safety First:</strong> In the code above, I’m casting <strong><em>records[0] as PlainText</em></strong> because I know what I&#39;m sending. In a production app, especially if receiving drags from other apps, use <strong><em>instance of</em></strong> checks to avoid runtime crashes.</li><li><strong>Performance on Wearables:</strong> Shadows and blurs are expensive. Keep the <strong><em>DragPreviewBuilder</em></strong> layout simple. Complex rendering during a drag event can cause dropped frames, which ruins the &quot;feel&quot; of the gesture.</li><li><strong>Animation Quirks:</strong> The <em>preview.animate()</em> method is powerful, but behavior can vary slightly across device versions. Always wrap it in a <strong><em>try/catch</em></strong> block so your app doesn&#39;t crash if the animation service is busy or unsupported.</li><li><strong>Reentrancy:</strong> I used an <strong><em>isDragging</em></strong> state to dim the button. This isn&#39;t just for looks; it helps you manage logic if you want to prevent multiple drag events from firing simultaneously.</li></ol><h3>Conclusion</h3><p>Mastering the dragController on HarmonyOS allows us to break free from static interfaces. By leveraging <strong>UnifiedDataChannel</strong>, we aren&#39;t just moving pixels; we are moving data securely and efficiently across the system.</p><p>On a 1.5-inch screen, every pixel and every gesture counts. Implementing custom previews and reactive drop zones turns a standard system behavior into a delightful user experience. The code provided here is your starting point now go build something that feels great to use.</p><p>Happy coding! 🚀</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-references/ts-universal-events-drag-drop#dragiteminfo">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05ab6a6b3220" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/mastering-custom-drag-previews-unifieddatachannel-05ab6a6b3220">Mastering Custom Drag Previews &amp; UnifiedDataChannel</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Background Tasks with Deferred Tasks in HarmonyOS Next]]></title>
            <link>https://medium.com/huawei-developers/managing-background-tasks-with-deferred-tasks-in-harmonyos-next-0a69b853e5e2?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a69b853e5e2</guid>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[harmony-os]]></category>
            <category><![CDATA[background-task]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Fri, 17 Oct 2025 07:19:27 GMT</pubDate>
            <atom:updated>2025-10-17T11:13:39.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDz9B2DJhjdtwZhbSh7m-Q.png" /><figcaption>Generated with AI</figcaption></figure><h3>Introduction</h3><p>Modern mobile applications often need to handle background operations — syncing data, uploading logs, or fetching periodic updates — without degrading system performance or battery life. However, managing these non-urgent tasks efficiently is a challenge. Developers must find a way to ensure that such tasks run intelligently in the background only when conditions are optimal.</p><p>In <strong>HarmonyOS Next</strong>, this problem is elegantly addressed with <strong>deferred tasks</strong>. These tasks allow developers to perform background work flexibly while letting the system decide the best time to execute them — balancing functionality, power efficiency, and user experience.</p><h3>Understanding Deferred Tasks</h3><p>Deferred tasks are designed for <strong>non-critical operations</strong> that can be delayed until ideal system conditions are met. Unlike <strong>transient tasks</strong>, which are executed immediately after an app goes into the background, deferred tasks wait for the right moment — such as when:</p><ul><li>📶 The device has network access (useful for syncing data)</li><li>⚡ It’s plugged in and charging</li><li>🔋 The battery level is sufficient</li><li>💾 There’s enough storage space</li><li>💤 The device is idle</li><li>📱 The app is categorized as active or frequently used</li></ul><p>This system-driven scheduling ensures that tasks consume minimal resources while maintaining a responsive and power-efficient experience for the user.</p><h3>Implementation Steps</h3><p>Implementing deferred tasks in HarmonyOS Next involves defining the background worker, specifying task conditions, and managing the task lifecycle.</p><ol><li>Create a WorkSchedulerExtensionAbility: This core component runs your deferred task logic in the background. It extends WorkSchedulerExtensionAbility and contains onWorkStart() and onWorkStop() callbacks. <br>- onWorkStart(workInfo: workScheduler.WorkInfo): This callback is invoked when the system decides to run your deferred task based on the defined conditions. You should implement your background logic here.<br>- onWorkStop(workInfo: workScheduler.WorkInfo): This callback is invoked when the task finishes, is canceled, or times out (after a maximum of 2 minutes). Use this for cleanup, logging, or saving the task’s state.</li><li>Configure module.json5: Register your WorkSchedulerExtensionAbility in the extensionAbilities section of your module.json5 file, specifying its name, source entry, and type as “workScheduler.”</li><li>Define WorkInfo: Create a WorkInfo object to specify the conditions under which your deferred task should run. This includes the task’s ID, bundle name, ability name, and desired conditions like networkType, isCharging, batteryLevel, isRepeat, and repeatCycleTime.</li><li>Schedule the Task: Use workScheduler.startWork(workInfo) to request the system to schedule your deferred task. It’s good practice to check if a task with the same ID already exists before creating a new one, especially for recurring tasks.</li><li>Cancel/Stop the Task: If needed, you can stop a deferred task using workScheduler.stopWork(workInfo).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/0*ImRJKp7oC3NEau3R.png" /><figcaption>Working Principle in Deferred Task</figcaption></figure><h3>Code Snippet</h3><p>1- WorkSchedulerExtensionAbility Implementation (e.g., MyWorker.ets)</p><pre>import { WorkSchedulerExtensionAbility, workScheduler } from &#39;@kit.BackgroundTasksKit&#39;;<br><br>export default class MyWorker extends WorkSchedulerExtensionAbility {<br>  onWorkStart(workInfo: workScheduler.WorkInfo) {<br>    console.info(`MyWorker: onWorkStart called for workId: ${workInfo.workId}`);<br>    // Simulate a background task, e.g., fetching data or syncing.<br>    // This is where your actual background logic goes.<br>    setTimeout(() =&gt; {<br>      console.info(`MyWorker: Task for workId ${workInfo.workId} completed.`);<br>    }, 1000); // Simulate a 1-second task<br>  }<br><br>  onWorkStop(workInfo: workScheduler.WorkInfo) {<br>    console.info(`MyWorker: onWorkStop called for workId: ${workInfo.workId}`);<br>    // Perform cleanup, save state, or log completion.<br>    // For example, update shared preferences with the last update time.<br>  }<br>}</pre><p>2- module.json5 Configuration</p><pre>{<br>  &quot;module&quot;: {<br>    &quot;extensionAbilities&quot;: [<br>      {<br>        &quot;name&quot;: &quot;MyWorker&quot;,<br>        &quot;srcEntry&quot;: &quot;./ets/workers/MyWorker.ets&quot;, // Adjust path as per your project<br>        &quot;type&quot;: &quot;workScheduler&quot;<br>      }<br>    ]<br>  }<br>}</pre><p>3- Task Management (e.g., in your EntryAbility.ets or a TaskManager class)</p><pre>​<br>import { workScheduler } from &#39;@kit.BackgroundTasksKit&#39;;<br>import { BusinessError } from &#39;@kit.BasicServicesKit&#39;;<br><br>// Function to schedule a deferred task<br>async function scheduleDeferredTask() {<br>  const WORK_ID = 1001; // Unique ID for your task<br>  const BUNDLE_NAME = &#39;com.example.yourapp&#39;; // Replace with your app&#39;s bundle name<br>  const ABILITY_NAME = &#39;MyWorker&#39;; // The name of your WorkSchedulerExtensionAbility<br><br>  const workInfo: workScheduler.WorkInfo = {<br>    workId: WORK_ID,<br>    bundleName: BUNDLE_NAME,<br>    abilityName: ABILITY_NAME,<br>    networkType: workScheduler.NetworkType.NETWORK_TYPE_WIFI, // Only run when Wi-Fi is available<br>    isCharging: true, // Only run when the device is charging<br>    // isRepeat: true, // Uncomment for repeating tasks<br>    // repeatCycleTime: 3 * 60 * 60 * 1000, // Repeat every 3 hours (min 2 hours for repeating tasks)<br>    isPersisted: true // Task can be restored after system restart<br>  };<br><br>  try {<br>    // Check if the task already exists before scheduling to avoid duplicates<br>    const existingWorks = await workScheduler.obtainAllWorks();<br>    const taskExists = existingWorks.some(work =&gt; work.workId === WORK_ID);<br><br>    if (!taskExists) {<br>      workScheduler.startWork(workInfo);<br>      console.info(`Deferred task with ID ${WORK_ID} scheduled successfully.`);<br>    } else {<br>      console.info(`Deferred task with ID ${WORK_ID} already exists. Skipping scheduling.`);<br>      // You might want to update existing task conditions here if needed<br>    }<br>  } catch (error) {<br>    console.error(`Failed to schedule deferred task. Code: ${(error as BusinessError).code}, message: ${(error as BusinessError).message}`);<br>  }<br>}<br><br>// Function to cancel a deferred task<br>function cancelDeferredTask() {<br>  const WORK_ID = 1001;<br>  const BUNDLE_NAME = &#39;com.example.yourapp&#39;;<br>  const ABILITY_NAME = &#39;MyWorker&#39;;<br><br>  const workInfo: workScheduler.WorkInfo = {<br>    workId: WORK_ID,<br>    bundleName: BUNDLE_NAME,<br>    abilityName: ABILITY_NAME<br>    // Other properties are not strictly required for stopWork if workId is unique<br>  };<br><br>  try {<br>    workScheduler.stopWork(workInfo);<br>    console.info(`Deferred task with ID ${WORK_ID} canceled successfully.`);<br>  } catch (error) {<br>    console.error(`Failed to cancel deferred task. Code: ${(error as BusinessError).code}, message: ${(error as BusinessError).message}`);<br>  }<br>}<br><br>// Example usage: Schedule when the app goes into the background<br>// In your EntryAbility.onBackground() or a similar lifecycle callback:<br>// scheduleDeferredTask();<br></pre><h3>Testing and Observation</h3><p>To verify deferred tasks, monitor the system logs for your application. You should observe:</p><ul><li>Scheduling confirmation: When workScheduler.startWork() is called, logs indicate that the task has been accepted by the system.</li><li>onWorkStart invocation: Logs from your WorkSchedulerExtensionAbility when the system triggers the task. This will happen when the specified WorkInfo conditions are met and the system deems it an opportune time.</li><li>onWorkStop invocation: Logs indicating the task has finished or been terminated.</li><li>Frequency observation: The system will intelligently decide the frequency of task execution based on factors like app usage, battery, and network conditions. You may notice delays in execution if conditions are not met or if the device is under heavy load.</li></ul><p>To invoke a deferred task manually, you should command:</p><pre> hidumper -s 1904 -a &#39;-t com.example.application MyWorkSchedulerExtensionAbility&#39;</pre><h3>Limitations or Considerations</h3><ul><li>Quantity Limit: An application can request a maximum of 10 deferred tasks concurrently.</li><li>Execution Frequency Limit: The system controls how often deferred tasks run based on the application’s activity group (e.g., active, frequently used, rarely used). The minimum interval can range from 2 hours to 48 hours, or even be forbidden for restricted applications.</li><li>Timeout: A WorkSchedulerExtensionAbility has a maximum execution duration of 2 minutes for a single onWorkStart callback. If the task doesn’t complete and explicitly calls stopWork() within this time, the system will forcibly terminate its process, followed by an onWorkStop() callback.</li><li>Scheduling Delay: Deferred tasks are not real-time. The system may delay scheduling based on current memory, power consumption, device temperature, and user habits to optimize overall system performance.</li><li>API Restrictions: Certain APIs, particularly those related to real-time operations like camera, audio, and some background task management functions, cannot be called within WorkSchedulerExtensionAbility to prevent resource misuse in the background.</li><li>Persistence: Ensure isPersisted is set to true in WorkInfo if you want the task to be restored after a device reboot.</li><li>Redundant Scheduling: Always query for existing tasks before scheduling a new one to avoid creating duplicate tasks, especially for non-repeating tasks or when the app frequently enters the background.</li></ul><h3>Real-World Insight</h3><p>Deferred tasks are particularly useful for:</p><ul><li>Syncing offline data when the user connects to Wi-Fi</li><li>Uploading analytics or logs while charging</li><li>Performing database cleanups or cache optimization during idle times</li></ul><p>By delegating timing control to the system, developers can create smarter and more battery-friendly apps without manually managing background execution logic.</p><h3>Conclusion</h3><p>Deferred tasks in HarmonyOS Next represent a <strong>modern, energy-efficient approach</strong> to background task scheduling. They allow developers to offload non-urgent operations without compromising the user experience or system health.</p><p>By leveraging <strong>WorkSchedulerExtensionAbility</strong> and <strong>WorkInfo</strong> configurations, you can build applications that are both <strong>responsive and power-conscious</strong>, aligning perfectly with HarmonyOS’s “intelligent scheduling” philosophy.</p><p>In short — if your app needs to “work silently but smartly,” deferred tasks are the way to go.</p><h3>References</h3><ul><li><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/work-scheduler#overview">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-workschedulerextensionability">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ability-kit">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a69b853e5e2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/managing-background-tasks-with-deferred-tasks-in-harmonyos-next-0a69b853e5e2">Managing Background Tasks with Deferred Tasks in HarmonyOS Next</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Natural Language Kit on HarmonyOS NEXT]]></title>
            <link>https://medium.com/huawei-developers/understanding-natural-language-kit-on-harmonyos-next-5b636311b0f7?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b636311b0f7</guid>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Sat, 09 Aug 2025 07:31:04 GMT</pubDate>
            <atom:updated>2025-08-09T07:31:04.142Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bibirJng9ghu3oA_N6OSsw.png" /><figcaption>Generated With AI — Natural Language Kit in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>HarmonyOS NEXT introduces a powerful tool for text understanding: the <strong>Natural Language Kit</strong>. Designed for developers who want to integrate intelligent language features into their applications, this kit provides core <strong>Natural Language Processing (NLP)</strong> capabilities that work <strong>natively within the Harmony ecosystem</strong>.</p><p>The Natural Language Kit is not just a text utility — it lays the foundation for building smart, context-aware apps. Whether you’re building a <strong>search engine</strong>, a <strong>chatbot</strong>, a <strong>news reader</strong>, or an <strong>intelligent assistant</strong>, this kit can help your app understand text <strong>semantically and structurally</strong>, in real time.</p><p>Currently, it offers <strong>two fundamental features</strong>:</p><ol><li><strong>Word Segmentation</strong><br> Breaks down raw text into individual word units, crucial for further NLP tasks like keyword extraction, semantic analysis, and search input optimization.</li><li><strong>Entity Extraction</strong><br> Detects meaningful elements in the text such as names, locations, dates, emails, phone numbers, and more — enabling use cases like auto-filling forms, enhancing reading experiences, or assisting in customer service.</li></ol><p>With these features, developers can:</p><ul><li>Extract structured insights from unstructured input.</li><li>Build smarter user interfaces that understand what users write.</li><li>Enhance app features such as <strong>autocomplete</strong>, <strong>text highlighting</strong>, <strong>data validation</strong>, and <strong>contextual responses</strong>.</li></ul><p>And the best part? It’s all done using <strong>simple API calls</strong>, without needing external ML models or complex libraries.</p><p>Let’s now dive into each feature in more detail — how they work, how to use them, and where they shine.</p><h4>🔍 Word Segmentation</h4><p><strong>What is it?</strong><br> Word segmentation splits a sentence into meaningful units such as words or phrases. This is especially important in languages like Chinese, where words are not separated by spaces. It’s also useful in English for keyword extraction and semantic analysis.</p><p><strong>Use Case Example:</strong><br> When a user enters a sentence in a search bar, the system segments the sentence into words to extract relevant keywords.</p><p><strong>Supported Languages:</strong> Simplified Chinese, Traditional Chinese, English<br> <strong>Max Text Length:</strong> 1000 characters<br> <strong>Note:</strong> Not supported on emulators.</p><p><strong>Development Flow:</strong></p><ol><li>Import the kit</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e27bb714d5cfdeaf815389628fcce84/href">https://medium.com/media/0e27bb714d5cfdeaf815389628fcce84/href</a></iframe><p>2.Capture input via a TextInput.</p><p>3.Use textProcessing.getWordSegment(inputText) to get the segmented result.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10beeff2dea03a504c1c24ec37c16c05/href">https://medium.com/media/10beeff2dea03a504c1c24ec37c16c05/href</a></iframe><p>4.Format the response to display:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ccc5b18b5c8fee89c813d4e94d9f492/href">https://medium.com/media/7ccc5b18b5c8fee89c813d4e94d9f492/href</a></iframe><blockquote><strong>Tip:</strong> You can easily bind this functionality to a button for real-time processing in the UI.</blockquote><h4>🧠Entity Extraction</h4><p><strong>What is it?</strong></p><p>Entity extraction automatically detects meaningful private information contained in text. These include assets such as contact names, email addresses, phone numbers, date and time. Thus, text content from the user can be converted to structured data.</p><p><strong>📚 Types of Recognizable Entities:</strong></p><ul><li>📅 DATETIME : Date and time information (e.g. “June 18, 2024”)</li><li>✉️ EMAIL : Email address</li><li>📦 EXPRESS_NO : Shipping tracking number</li><li>✈️ FLIGHT_NO : Flight number</li><li>📍 LOCATION : Location / address</li><li>👤 NAME : Contact name</li><li>📞 PHONE_NO : Phone number</li><li>🌐 URL : Web address</li><li>🔐 VERIFICATION_CODE :Verification code</li><li>🆔 ID_NO : ID number</li></ul><p><strong>Use Case Example:</strong></p><p>News reading apps: Highlight important person, place, and date information in the text</p><p>Customer service: Automatically extract information such as phone, shipping, or verification code from user-submitted text</p><p>Finance apps: Simplify transactions by detecting identity or verification codes</p><p><strong>Supported Languages:</strong> Simplified Chinese, Traditional Chinese, English<br><strong>Max Text Length:</strong> 1000 characters<br><strong>Note:</strong> Not supported on emulators.</p><p><strong>Development Flow:</strong></p><ol><li>Include the library in the project:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/505e34bff8d3ca4dda2ed6c25f655707/href">https://medium.com/media/505e34bff8d3ca4dda2ed6c25f655707/href</a></iframe><p>2. Specify which entity types you want to detect:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/269aff7c213477eaabc451de3eb8ef03/href">https://medium.com/media/269aff7c213477eaabc451de3eb8ef03/href</a></iframe><p>3. When the button is pressed, call the getEntity() function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6d9d510c02b2822af4f2a951e8b6181/href">https://medium.com/media/d6d9d510c02b2822af4f2a951e8b6181/href</a></iframe><p>4. Process the results as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/843447be6b0f70aecd3a3b882c2b598a/href">https://medium.com/media/843447be6b0f70aecd3a3b882c2b598a/href</a></iframe><h4>Conclusion</h4><p>HarmonyOS NEXT’s Natural Language Kit provides developers with built-in and easy-to-use NLP tools. It allows you to perform basic operations, such as word segmentation and asset extraction, quickly and efficiently, on the device.</p><p>This kit is an important step in natural language processing in the HarmonyOS ecosystem, offering a robust infrastructure for intelligent applications ranging from search engines to chatbots, news apps to customer support systems.</p><p>Making sense of your application is now a few lines of code.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/natural-language-kit-guide">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b636311b0f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/understanding-natural-language-kit-on-harmonyos-next-5b636311b0f7">Understanding Natural Language Kit on HarmonyOS NEXT</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MindSpore Lite Kit on HarmonyOS NEXT: Tiny AI, Big Impact]]></title>
            <link>https://medium.com/huawei-developers/mindspore-lite-kit-on-harmonyos-next-tiny-ai-big-impact-9710e0cf5250?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9710e0cf5250</guid>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[image-classification]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 08:30:40 GMT</pubDate>
            <atom:updated>2025-08-06T08:30:40.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4Jv2ZdN_w1lXBYfNL31tQ.png" /><figcaption>Generated With AI — MindSpore Lite Kit in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>In this article, I will tell you, my dear readers, about the MindSpore lite kit. Today, AI applications aren’t limited to powerful servers. Fast, secure and offline AI experiences are made possible by on-device inference solutions that work in mobile and embedded systems. The MindSpore lite kit is a lightweight AI engine developed for just that need and works integrated with the HarmonyOS NEXT operating system.</p><p>Based solely on the official document, we will discuss in detail what the MindSpore lite kit offers, in which scenarios it can be used, its advantages, and the development process.<br>Let’s get started</p><h4>What is the MindSpore lite kit?</h4><p>MindSpore is a lightweight AI inference engine embedded in HarmonyOS NEXT. This open-source AI framework provides a friendly development environment for data scientists, algorithm engineers, and developers. Its multi-core architecture supports high-performance inference processes and aims to strengthen the software-hardware ecosystem.</p><h4>Use Scenarios</h4><p>The MindSpore lite kit is currently being used successfully in a variety of visual AI tasks:</p><ul><li>Image Classification: For example, identifying an image as a cat, dog, plane, or car.</li><li>Object Recognition: Recognize, label, and mark objects in camera view with bounding boxes.</li><li>Image Segmentation: Positioning a particular object in an image at the pixel level.</li></ul><h4>Benefits of MindSpore lite</h4><p>✅ High Performance<br>It includes core algorithms and optimization techniques that provide high throughput with low latency and low power consumption.</p><p>🪶Lightweight Construction<br>Allows fast operation of small, compressed models. It can work comfortably even on extremely resource-constrained devices.</p><p>🌐 Support in All Scenarios<br>It can work on different operating systems and embedded devices. Offers wide hardware support.</p><p>⚙️Efficient Deployment Process<br>MindSpore, Caffe, and ONNX models are supported. Model conversion, compression, and data manipulation tools are available.</p><h4>Development Process</h4><p>There are two basic steps to developing apps with MindSpore lite:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OVeS-KCThJ-h6WzI.png" /><figcaption>Development process for MindSpore Lite model inference</figcaption></figure><h4>1. Model Conversion</h4><p>MindSpore lite uses models with a.ms extension for inference. Or convert your existing TensorFlow TFLite, ONNX or Caffe models.</p><h4>2. Model Distribution</h4><p>The following operations are performed step by step:</p><ol><li>Inference media (context) is created according to device and hardware characteristics.</li></ol><p>2. The model with a .ms extension is installed.</p><p>3. The input data is defined.</p><p>4. Model inference is made and output results are obtained.</p><h4>Improvement Methods</h4><p>MindSpore lite can be integrated on HarmonyOS NEXTin two different ways:</p><p><strong>Method 1 (Direct Use with ArkTS) </strong>: Model execution can be done quickly by providing direct access to MindSpore Lite APIs from the UI layer.</p><p><strong>Method 2 (Using Native API)</strong> : Algorithm models can be called over ArkTS with N-API by incorporating dynamic libraries.</p><h4>Relationship to NNRt</h4><p>MindSpore is compatible with the Neural Network Runtime (NNRt) on HarmonyOS. The NNRt serves as a bridge between the inference engine and the hardware accelerator (e.g., the NPU). Using NNRt, developers can accelerate the AI model on the device’s AI chip.</p><h3>Conclusion</h3><p>The MindSpore lite kit provides an efficient, lightweight and powerful AI infrastructure for smart devices integrated with HarmonyOS NEXT. Enables you to develop applications that work in real time and offline with low resource consumption while providing effective solutions for common scenarios such as image processing and object recognition.</p><p>If you want to develop AI solutions on HarmonyOS, starting with the MindSpore lite kit is a great step.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/mindspore-lite-kit-introduction">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9710e0cf5250" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/mindspore-lite-kit-on-harmonyos-next-tiny-ai-big-impact-9710e0cf5250">MindSpore Lite Kit on HarmonyOS NEXT: Tiny AI, Big Impact</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Face Liveness Detection in HarmonyOS: A VisionKit Implementation Guide]]></title>
            <link>https://medium.com/huawei-developers/face-liveness-detection-in-harmonyos-a-visionkit-implementation-guide-2c027b21f434?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c027b21f434</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[vision-kit]]></category>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[ark-ts]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 07:56:11 GMT</pubDate>
            <atom:updated>2025-07-28T08:01:45.644Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JkqzPf3lNbdNUkfijn1DPA.png" /><figcaption>Generated With AI - VisionKit in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>Hello everyone! In this article, I’ll talk about Huawei’s HarmonyOS NEXT. It comes with VisionKit, a powerful tool that lets developers use AI-powered visual features. Here, I’ll focus on the Face Liveness Detection (interactiveLiveness) feature and explain how to integrate it into an app with examples.</p><h4>📌 What is Face Liveness Detection?</h4><p>Face Liveness Detection is a technology used to distinguish real human faces from fake ones (like photos, videos, or masks) through a device’s camera. In HarmonyOS NEXT, this feature verifies authenticity by asking users to perform interactive actions, such as blinking or nodding their head.</p><h4>🎯 Use Cases</h4><p>✅ Attendance tracking systems<br>✅ Secure app logins (identity verification)<br>✅ Fake user detection<br>✅ ID verification support</p><h4>🧑‍💻 Development Steps</h4><h4>1. Add Required Module &amp; Permissions</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf8a5a4bc908e7219e5cc3a6d62313e3/href">https://medium.com/media/bf8a5a4bc908e7219e5cc3a6d62313e3/href</a></iframe><p>Add camera permission to your module.json5 file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c494032813fdd874c8263655b5bdd57/href">https://medium.com/media/3c494032813fdd874c8263655b5bdd57/href</a></iframe><h4>2. Design the User Interface</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b40d8ced1ab6b403f63cfb55167c106/href">https://medium.com/media/3b40d8ced1ab6b403f63cfb55167c106/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bffe3a529b8dd6c9f8553a75628ca43e/href">https://medium.com/media/bffe3a529b8dd6c9f8553a75628ca43e/href</a></iframe><h4>3. Add a Start Button</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76fc286f3f842e064b1ae8f875afc682/href">https://medium.com/media/76fc286f3f842e064b1ae8f875afc682/href</a></iframe><h4>4. Handle Permissions &amp; Setup</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8b7174cacafbbb531f5bdf207320dd5/href">https://medium.com/media/f8b7174cacafbbb531f5bdf207320dd5/href</a></iframe><h4>5. Start Liveness Detection</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/980455b4cb35493f96d314a93e56fd25/href">https://medium.com/media/980455b4cb35493f96d314a93e56fd25/href</a></iframe><h4>6. Get the Result</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22b510507ea40be70f580e1b19591351/href">https://medium.com/media/22b510507ea40be70f580e1b19591351/href</a></iframe><h3>🛠️ About the APIs</h3><p>The interactiveLiveness module provides the following key functionalities for implementing face liveness detection:</p><p>⚙️<strong>startLivenessDetection(config: InteractiveLivenessConfig): Promise&lt;boolean&gt;</strong><br> Launches the face liveness detection screen using the provided configuration. The result of the redirection (success or failure) is returned as a Promise.</p><p><strong>⚙️getInteractiveLivenessResult(): Promise&lt;InteractiveLivenessResult&gt;<br></strong> Retrieves the result of the liveness detection asynchronously. The returned result includes the detection mode, the best image captured, and optionally a secured buffer and certificate chain (for image security verification scenarios).</p><p><strong>⚙️InteractiveLivenessConfig<br></strong> A configuration object that allows you to customize the liveness detection behavior. It includes parameters such as:</p><ul><li>isSilentMode: Defines the detection mode. Only INTERACTIVE_MODE is currently supported.</li><li>actionsNum: Specifies how many user actions (like blinking, nodding, etc.) will be randomly selected for detection. Only 3 or 4 actions are supported.</li><li>routeMode: Determines how the app navigates after detection, using either REPLACE_MODE or BACK_MODE.</li><li>successfulRouteUrl / failedRouteUrl: Optional paths to navigate after success or failure.</li><li>Additional options such as challenge (for security scenarios), speechSwitch (voice guidance), and isPrivacyMode (requires permission).</li></ul><p><strong>⚙️Enum Types for Configuration:</strong></p><ul><li>DetectionMode: Defines the detection method. Currently, only INTERACTIVE_MODE is available.</li><li>ActionsNumber: Specifies the number of required actions (3 or 4).</li><li>RouteRedirectionMode: Controls routing behavior after detection (BACK_MODE or REPLACE_MODE).</li></ul><p>📌 <em>For full details, check the official </em><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-references/vision-interactive-liveness"><em>API documentation</em></a><em>.</em></p><h4>🎉 Conclusion</h4><p>The interactiveLiveness feature offered by VisionKit provides significant advantages for user verification and preventing fake face attacks in your HarmonyOS applications. It’s easy to use, runs on-device, and responds very quickly according to device performance.</p><p>If you’re developing a security-focused application or just want to add a user verification layer, this feature is perfect for you.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/vision-interactiveliveness">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c027b21f434" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/face-liveness-detection-in-harmonyos-a-visionkit-implementation-guide-2c027b21f434">🧠Face Liveness Detection in HarmonyOS: A VisionKit Implementation Guide</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Intents Kit in HarmonyOS Next? What Does It Offer Differently Compared to Android?]]></title>
            <link>https://medium.com/huawei-developers/what-is-intents-kit-in-harmonyos-next-what-does-it-offer-differently-compared-to-android-220f3f075b95?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/220f3f075b95</guid>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 07:55:12 GMT</pubDate>
            <atom:updated>2025-07-31T08:52:14.578Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NB7WrCw_nwByERxKYAkP2g.png" /><figcaption>Generated With AI — Intents Kit in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>In this article, I will talk about the HarmonyOS NEXT Intent Kit, Huawei’s next-generation operating system. HarmonyOS NEXT is not only an alternative to Android, but it also brings a whole new approach to app interactions: the Intents Kit.<br>Unlike the traditional Intent structure, it analyzes user behavior and provides AI-powered guidance, providing a smarter and more intuitive way to manage application workflows.</p><h4>📌 <strong>What is Intents Kit?</strong></h4><p><strong>Intents Kit</strong> allows applications or atomic services in <strong>HarmonyOS Next</strong> to expose their capabilities to the system. Once shared, these capabilities can be intelligently recognized and distributed by the system to various access points — such as <strong>Celia Chat</strong>, <strong>search results</strong>, or <strong>smart suggestions</strong>. This enables users to access specific app features without directly opening the app, creating a smoother, more seamless experience. In essence, Intents Kit acts as a smart bridge between app functionality and system-level intelligence, making the overall ecosystem more responsive and user-friendly.</p><h4>⚙️ <strong>How Does It Work?</strong></h4><p>Within the HarmonyOS ecosystem, the user’s <strong>intent</strong> is detected by the system through various channels:</p><ul><li>Voice commands (Celia Chat)</li><li>Search (Celia Search)</li><li>User habits (Celia Suggestions)</li><li>Notifications</li></ul><p>Based on the detected intent, your app’s specific function can be triggered accordingly.</p><p>🧠 <strong>Here’s the key point:</strong><br> The app is no longer called directly — it’s triggered indirectly through <strong>user intent</strong>.</p><h4>🧠 How Is an Intent Defined?</h4><p>As an app developer:</p><p>You define an <strong>intent schema</strong> (for example: “search flight”, “recommend movie”, “track order”).</p><ul><li>You register this intent with the system using the <strong>Intents Kit API</strong>.</li><li>The system then suggests or directly triggers this intent at the right moments for the user.</li></ul><h4>💡 What’s the Difference From Android?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1mZgy8ZU-nXjMZdu15V4w.png" /><figcaption>Difference Table</figcaption></figure><h4>📦 Deployment Categories (Smart Distribution)</h4><p>Intents Kit can be deployed according to different contexts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c9bwEMlJvFff4O6ee7pFEg.png" /><figcaption>Smart Distribution Table</figcaption></figure><h4><strong>🔁</strong> Intent Modes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B70HNgPmZ9Fsb7Zos7OCaA.png" /><figcaption>Modes Table</figcaption></figure><h4>🚀 Future Vision</h4><p>HarmonyOS Next and Intents Kit together provide:</p><ul><li>User’s seamless cross-device experience</li><li>Intent-based application interaction</li><li>AI-powered, context-based recommendations</li><li>System-level accessibility of application content</li></ul><h3>🎯Conclusion</h3><p>Intents Kit changes the paradigm of app development:<br>It paves the way for systems that understand the user’s intention and take the first step, instead of applications that “wait for the user to push the button.”</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/intents-kit-guide">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=220f3f075b95" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/what-is-intents-kit-in-harmonyos-next-what-does-it-offer-differently-compared-to-android-220f3f075b95">What is Intents Kit in HarmonyOS Next? What Does It Offer Differently Compared to Android?</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate VideoKit in HarmonyOS Next: A Step-by-Step Development Guide]]></title>
            <link>https://medium.com/huawei-developers/how-to-integrate-videokit-in-harmonyos-next-a-step-by-step-development-guide-af208f468c21?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/af208f468c21</guid>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[videokit]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 07:46:34 GMT</pubDate>
            <atom:updated>2025-07-28T08:02:43.136Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXPDfUduMftfzjEgkQj6wQ.jpeg" /><figcaption>Generated With AI — VideoKit in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>In this article, I’ll show you step by step how to integrate video playback with VideoKit into your HarmonyOS Next app. We’re going to take the name of the video that comes with page transitions and go through an example that gives the user a modern player interface.</p><h4>What is VideoKit?</h4><p>VideoKit provides an API that simplifies video playback within HarmonyOS. Lets you easily play, pause, and resume media files. It also includes useful structures for managing user interactions, such as VideoController.</p><h4>1. Retrieving Video Source When Page Opens</h4><p>When the user is redirected to the video playback page, we determine the video source by retrieving the video name from the redirect parameter. In this example, I placed the videos inside the resources/raw directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*wnv7JJHAxROXHVi7bQlPPw.png" /><figcaption>RawFile Image</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7eaebe9d45e7c8ec2b4575c249ea60d/href">https://medium.com/media/d7eaebe9d45e7c8ec2b4575c249ea60d/href</a></iframe><p>This allows us to dynamically process video names from different pages.</p><h4>2. Creating the Video Component</h4><p>The video component is created with the Video() function and the src and controller parameters are given to it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/825f1af6459e9168c29a3bb65f6b61d6/href">https://medium.com/media/825f1af6459e9168c29a3bb65f6b61d6/href</a></iframe><ul><li>autoPlay(true): Automatically starts when the page opens.</li><li>controls(true): Shows the user interface controls.</li><li>onClick(): Play/pause is done when the video is clicked.</li></ul><h4>3. User Interaction: Play and Pause</h4><p>The togglePlayPause function is used to play/pause the video when the user clicks on it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edd2f931ff594cf116e99f8a360492bb/href">https://medium.com/media/edd2f931ff594cf116e99f8a360492bb/href</a></iframe><h4>Full Page Code</h4><p>Below you can see the entire page code. Here is an example that starts the video name that comes up on the page:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/688e089d3a3dbca39a9e1a00f9d77074/href">https://medium.com/media/688e089d3a3dbca39a9e1a00f9d77074/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*OkqTm3XwTktsB3sh3T9jeQ.gif" /><figcaption>Video Generated With AI</figcaption></figure><h3>Conclusion</h3><p>Developing video playback functionality with HarmonyOS Next is a very simple and effective process. In this article, we have learned step by step how to develop a user-friendly video player interface using the VideoKit API. Especially, routing dynamic video sources and controlling them with user interaction is very important for real-world applications.</p><p>You can also develop this structure and bring your own media player application or video content project to life.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/media-kit-intro">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af208f468c21" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-integrate-videokit-in-harmonyos-next-a-step-by-step-development-guide-af208f468c21">How to Integrate VideoKit in HarmonyOS Next: A Step-by-Step Development Guide</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Atomic Services with DevEco Studio: Structure and Step-by-Step Implementation]]></title>
            <link>https://medium.com/huawei-developers/building-atomic-services-with-deveco-studio-structure-and-step-by-step-implementation-7903774fc0c8?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7903774fc0c8</guid>
            <category><![CDATA[huawei-appgallery]]></category>
            <category><![CDATA[atomic-services]]></category>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Fri, 13 Jun 2025 13:01:37 GMT</pubDate>
            <atom:updated>2025-07-28T08:02:57.013Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4lA8uBTFAiJGy7PbGtMDg.jpeg" /><figcaption>Generated With AI — Atomic Services in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>In this article, we will explore the concept of Atomic Service in the HarmonyOS Next ecosystem and how it addresses the evolving needs of mobile users.</p><p>Traditional mobile apps are usually full-screen and offer many features. However, today’s users want faster, simpler, and more focused experiences. This is where the concept of Atomic Service comes in.</p><p>Atomic Service is a lightweight and independent micro-app in the HarmonyOS Next ecosystem. It is not a full app, but more like a “mini service” designed to do just one task. It allows users to interact quickly without opening the entire app.</p><h4><strong>What Is Atomic Service Used For?</strong></h4><ul><li><strong>Simplifies user experience:</strong> Users can complete tasks without fully opening the app.</li><li><strong>Saves time:</strong> Fast access for quick actions like scanning a QR code, checking the weather, or placing a food order.</li><li><strong>Supports modular design:</strong> Developers can build small task-focused parts instead of one big app.</li><li><strong>Works in many scenarios:</strong> Can be accessed from widgets, search suggestions, service panels, smartwatches, or voice assistants.</li></ul><h4><strong>Where Is It Used?</strong></h4><ul><li>Direct access from the <strong>HarmonyOS Launcher</strong></li><li><strong>Cross-device usage:</strong> On smartwatches, TVs, car systems, and more</li><li><strong>Smart assistant</strong> or <strong>search screen suggestions</strong></li><li><strong>Widget-like quick tasks:</strong> Viewing the weather, adding to a shopping cart, creating a calendar event, etc.</li></ul><p>Atomic Services are great for today’s world, where micro-interactions matter. They bring many benefits for both users and developers.</p><h3>How to Create an Atomic Service Application</h3><p><strong>1. Choose Atomic Service Template</strong></p><p>In the first step, we start by selecting the <strong>Atomic Service</strong> template from the <em>Ability Template</em> section.<br> We choose the <strong>Empty Ability</strong> option to begin with a blank Atomic Service structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RGMJy-fLlpWh0ZmPzODwQ.png" /><figcaption>Atomic Service Template</figcaption></figure><p><strong>2. Register Your Atomic Service in AppGallery Connect</strong></p><p>To continue, we need to register our Atomic Service in <strong>AppGallery Connect</strong>.<br>If we don’t have an <strong>App ID</strong>, we click on <strong>“Register App ID”</strong> to create one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BwO495E4Ny6Y84P15_JnIw.png" /><figcaption>Register Atomic Service</figcaption></figure><p><strong>3. Fill in App Details in AppGallery Connect</strong></p><p>We are now redirected to the AppGallery Connect page.<br>Here, we enter the <strong>App Name</strong> and choose the appropriate <strong>App Category</strong>, then proceed by clicking <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBqQ-G4bzGt_MKRjLJ4IPQ.png" /><figcaption>App Details AppGallery Connect</figcaption></figure><p><strong>4. Enter Project Name</strong></p><p>In this step, we are asked to provide a <strong>Project Name</strong>.<br>We type the name we want for our project and move forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_XPVscrHHhUMZjpuxxcMg.png" /><figcaption>Project Name AppGallery Connect</figcaption></figure><p><strong>5. Select the Application in DevEco Studio</strong></p><p>Finally, we return to <strong>DevEco Studio</strong>, and our new application now appears in the list.</p><p>We select our application and continue with the setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoyXZz3Jre-nXbZ-OW1sSA.png" /><figcaption>Select the Application</figcaption></figure><p>And finally, our project is ready to be created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RhSgwUgqzCWf9GolyeqgEw.png" /><figcaption>Create the Project</figcaption></figure><h3>Conclusion</h3><p>In this article, we learned how to add visual markers and shapes on the map using MapKit components in HarmonyOS Next. These functions offer powerful tools if you want to provide the user with spatial information, highlight areas, or guide them in your application.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-references/atomic-services">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7903774fc0c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/building-atomic-services-with-deveco-studio-structure-and-step-by-step-implementation-7903774fc0c8">Building Atomic Services with DevEco Studio: Structure and Step-by-Step Implementation</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️How to Use MapKit in HarmonyOS: Location & Mapping Integration Guide]]></title>
            <link>https://medium.com/huawei-developers/%EF%B8%8Fhow-to-use-mapkit-in-harmonyos-location-mapping-integration-guide-0632fb73ea1d?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/0632fb73ea1d</guid>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[mapkit]]></category>
            <category><![CDATA[harmonyos-next]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 06:33:13 GMT</pubDate>
            <atom:updated>2025-08-09T17:23:56.978Z</atom:updated>
            <content:encoded><![CDATA[<h3>🗺️How to Use MapKit in HarmonyOS Next: Location &amp; Mapping Integration Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmIO2UDNOtttTC6bam9sAQ.jpeg" /><figcaption>Generated With AI — Map Kit</figcaption></figure><h3>Introduction</h3><p>HarmonyOS Next provides a powerful MapKit API for map display and location-based operations in your applications. In this article, we will look in detail how to integrate maps on HarmonyOS with @kit.MapKit component and how to add map shapes such as Marker, MapCircle, MapPolygon, MapPolyline and MapArc. We will use the coordinates of Izmir as an example.</p><p>To use MapKit in HarmonyOS Next projects, you need to import the following modules:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14224dce2e771656e2d4cff306eed54a/href">https://medium.com/media/14224dce2e771656e2d4cff306eed54a/href</a></iframe><h4>🧱 Map Component and Configuration</h4><p>We use MapComponent to create the map view in HarmonyOS Next. The center coordinates and zoom level are determined via MapOptions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d54bd73b063d4a3458318f4a68f4546b/href">https://medium.com/media/d54bd73b063d4a3458318f4a68f4546b/href</a></iframe><h4>📍Adding a Marker</h4><p>A marker is used to put a pin in a specific location. It is added with the addMarker function as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b254b26af55ed28f6acbad0e64d922f8/href">https://medium.com/media/b254b26af55ed28f6acbad0e64d922f8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*3OrY14ZYkiFIBgDChOimpQ.jpeg" /><figcaption>Map Display Marker</figcaption></figure><h4>🔵 Adding MapCircle</h4><p>You can visually highlight a particular area by adding a circle:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9e5b616ea2dd3808a4da6219b67869d/href">https://medium.com/media/f9e5b616ea2dd3808a4da6219b67869d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*NjQ4P7ccClNPQC1yi3yAGQ.jpeg" /><figcaption>Map Display Circle</figcaption></figure><h4>🔷 Adding MapPolygon</h4><p>You can surround a specific area with a polygon:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/271221f0bedfdaa6e1658a92534accb8/href">https://medium.com/media/271221f0bedfdaa6e1658a92534accb8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*T8x1-BC_xqiYPCa5v-F3-Q.jpeg" /><figcaption>Map Display Polygon</figcaption></figure><h4>➖Adding MapPolyline</h4><p>Polyline is used to draw a straight line between two or more points:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56b310d890746794776db8c21ba710bd/href">https://medium.com/media/56b310d890746794776db8c21ba710bd/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*g_d7u7mbKVeLMxFjSOqoZw.jpeg" /><figcaption>Map Display Polyline</figcaption></figure><h4>🌀 Adding MapArc</h4><p>For more aesthetic visuality, you can also draw a curved arc between the two points:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/53567465157e2a222484ad70f46b61ad/href">https://medium.com/media/53567465157e2a222484ad70f46b61ad/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*k9sbVloCsc-WhC1HTEya8Q.jpeg" /><figcaption>Map Display Arc</figcaption></figure><h4>🛠️ Full Component Structure</h4><p>All these shapes are added to the map via the mapController after a MapComponent call. Within the build() function, the map component is used as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fde985ac9108cdb2b07cb4b464c6a9bf/href">https://medium.com/media/fde985ac9108cdb2b07cb4b464c6a9bf/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*YTmYpZMS574H5VXXmnxzYA.jpeg" /><figcaption>Map Display</figcaption></figure><h3>🚀 Conclusion</h3><p>In this article, we learned how to add visual markers and shapes on the map using MapKit components in HarmonyOS Next. These functions offer powerful tools if you want to provide the user with spatial information, highlight areas, or guide them in your application.</p><h3>References</h3><ul><li><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-references/map-map">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/map-introduction">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0632fb73ea1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/%EF%B8%8Fhow-to-use-mapkit-in-harmonyos-location-mapping-integration-guide-0632fb73ea1d">🗺️How to Use MapKit in HarmonyOS: Location &amp; Mapping Integration Guide</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build Dynamic Widgets in HarmonyOS: A Step-by-Step Guide]]></title>
            <link>https://medium.com/huawei-developers/how-to-build-dynamic-widgets-in-harmonyos-a-step-by-step-guide-508c087b07dd?source=rss-6ad02bd0dcc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/508c087b07dd</guid>
            <category><![CDATA[ark-ts]]></category>
            <category><![CDATA[widget]]></category>
            <category><![CDATA[harmony-os]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Baristuzemenn]]></dc:creator>
            <pubDate>Thu, 29 May 2025 13:33:40 GMT</pubDate>
            <atom:updated>2025-07-28T08:03:28.192Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Build Dynamic Widgets in HarmonyOS Next: A Step-by-Step Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lr0Xqps5yLr0p19i4aNc9Q.jpeg" /><figcaption>Generated With AI — Dynamic Widgets in HarmonyOS NEXT</figcaption></figure><h3>Introduction</h3><p>In this article, we will look at how to develop a dynamic widget step by step, moving through an already created HarmonyOS project. I’ll keep the basics simple, from installation to configuration, lifecycle to event management.</p><h4>How to add widgets</h4><p>First, we need to determine which module to add our widget to. I will use the entry module in this example.</p><h4>➕ Widget Creation Steps:</h4><p>Right-click the entry module.</p><p>From the menu, follow the steps: <strong>New -&gt; Service Widget -&gt; Dynamic Widget.</strong></p><p>When you complete this process, a new folder called <em>widget </em>should be created under your <em>entry </em>module.</p><p>You should have a <em>WidgetCard.ets</em> file under Pages where you can do things about your widget.</p><p>A <em>form_config.json</em> file will also be automatically added under the resources folder.</p><p>Also, your <em>EntryFormAbility </em>file was created automatically</p><h4>🖼️ What is the WidgetCard.ets?</h4><p>Where we define the visual interface of our widget is the WidgetCard component. This component is marked with <a href="http://twitter.com/Component">@Component</a> annotation and is used to configure content to be displayed on the widget.</p><p>The following is a sample WidgetCard component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ed527528a75f87d3ecead8ec5e4745c/href">https://medium.com/media/8ed527528a75f87d3ecead8ec5e4745c/href</a></iframe><p>This component displays the text “Hello World” in full screen and when clicked triggers a redirect with the message “add detail” via EntryAbility</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5a1nBAFKk-E0g_X9a0Ogow.jpeg" /><figcaption>How to add Widget HarmonyOS</figcaption></figure><h4>⚙️ What is form_config.json?</h4><p>This file contains the configuration settings for your widget. For example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3406e46c5c0963d52d07ec3e6217c6dc/href">https://medium.com/media/3406e46c5c0963d52d07ec3e6217c6dc/href</a></iframe><p>Through this configuration, you can customize settings such as the widget’s sizes, dimensions and update frequency.</p><h4>🧠What is EntryFormAbility?</h4><p>The <em>EntryFormAbility </em>class is automatically created to manage widget-related lifecycle events. Basically, here are the following methods:</p><h4>🔹 onAddForm(want: Want)</h4><p>Called when a new form is added. Creates and returns form data:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67d3928d3de91a5788bdd645b7a9f168/href">https://medium.com/media/67d3928d3de91a5788bdd645b7a9f168/href</a></iframe><h4>🔹 onUpdateForm(formId: string)</h4><p>This is the function that is called when you need to update the form:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69cb77ceb5a06860677b8b0f392667ed/href">https://medium.com/media/69cb77ceb5a06860677b8b0f392667ed/href</a></iframe><h4>🔹 onFormEvent(formId: string, message: string)</h4><p>Works when special events such as user interactions are triggered on the widget:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc9f4475140a72dbafcd96d9901ab602/href">https://medium.com/media/cc9f4475140a72dbafcd96d9901ab602/href</a></iframe><h3>🚀 Conclusion</h3><p>Although the process of widget development on HarmonyOS may seem complicated at first, with the right steps, it can turn into a very pleasant experience. In this article, I only touched on beginner dynamic widget setup. In future articles, I will cover advanced topics such as data transmission, scheduled updates, and user interactions.</p><h3>References</h3><p><a href="https://developer.huawei.com/consumer/en/doc/harmonyos-guides/form-kit">Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=508c087b07dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-build-dynamic-widgets-in-harmonyos-a-step-by-step-guide-508c087b07dd">How to Build Dynamic Widgets in HarmonyOS: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>