<?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 RChancha on Medium]]></title>
        <description><![CDATA[Stories by RChancha on Medium]]></description>
        <link>https://medium.com/@rchancha?source=rss-1b1200c53a3a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by RChancha on Medium</title>
            <link>https://medium.com/@rchancha?source=rss-1b1200c53a3a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 20:43:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rchancha/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[Requesting Network Data and showing notification in Harmony OS (Java Script)]]></title>
            <link>https://medium.com/huawei-developers/requesting-network-data-and-showing-notification-in-harmony-os-java-script-1447c2184ebb?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1447c2184ebb</guid>
            <category><![CDATA[huawei-developers]]></category>
            <category><![CDATA[harmony-os]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 07:20:26 GMT</pubDate>
            <atom:updated>2021-07-09T07:20:26.001Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Harmony OS is a future-proof distributed operating system open to you as part of the initiatives for all-scenario strategy, adaptable to <strong>mobile office</strong>, <strong>fitness</strong> and <strong>health</strong>, <strong>social</strong> <strong>communication</strong>, and <strong>media</strong> <strong>entertainment</strong>, etc. Unlike a legacy operating system that runs on a standalone device, Harmony OS is built on a distributed architecture designed based on a set of system capabilities. It can run on a wide range of device forms, including <strong>smartphones</strong>, <strong>tablets</strong>, <strong>wearables</strong>, <strong>smart</strong> <strong>TVs</strong> and <strong>head</strong> <strong>units</strong>.</p><p>In this article, we will make network request using Harmony OS <strong>fetch API</strong> to get the response. Once we get response in callback, we will parse and show response in notification.</p><p>Network request looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*Y8WW3RFVk8KTBH-NKQt5mA.png" /></figure><h3><strong>Requirement</strong></h3><p>1) DevEco IDE</p><p>2) Wearable simulator</p><h3><strong>Implementation</strong></h3><p>First page, <strong>index.hml </strong>contains button <strong>Start</strong>, on click of it, we will make network call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4413fef6096495883c199786dab0f462/href">https://medium.com/media/4413fef6096495883c199786dab0f462/href</a></iframe><p><strong>index.css</strong> has style defined for the page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b4e6db8dd65a851da66b3010abd0ecc/href">https://medium.com/media/0b4e6db8dd65a851da66b3010abd0ecc/href</a></iframe><p>Firstly, we need to import the <strong>fetch </strong>and<strong> notification</strong> module in <strong>index.js</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fc58406fcf8ee23bf6d4e0257893f06/href">https://medium.com/media/8fc58406fcf8ee23bf6d4e0257893f06/href</a></iframe><p>On click on start button, we will make network request using <strong>fetch API. </strong>After receiving response, we will use JSON to parse the result.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37380eb79e0498f5f1edd4e22525f5c5/href">https://medium.com/media/37380eb79e0498f5f1edd4e22525f5c5/href</a></iframe><p>After parsing the result, we will show the result in notification</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d659fe586e602771b71d447ffb824363/href">https://medium.com/media/d659fe586e602771b71d447ffb824363/href</a></iframe><p>Code snippet of <strong>index.js</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d663a701d858d92bdf9006f791c1fed/href">https://medium.com/media/7d663a701d858d92bdf9006f791c1fed/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*EcDyHM0xUP4L9j2uHtXaAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*9irR78Xh_ItAZHxRleppVA.png" /></figure><h3><strong>Tips and Tricks</strong></h3><ol><li>If you want to support multiple device, you can add device type in <strong>config.json</strong></li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b6d8f72e7a57f92bf5663ff5760a688/href">https://medium.com/media/9b6d8f72e7a57f92bf5663ff5760a688/href</a></iframe><p>2. HTTPS is supported by default. To support HTTP, you need to add <strong>“network”</strong> to the <strong>config.json</strong> file, and set the attribute <strong>“usesCleartext”</strong> to <strong>true</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69ce50e1141de2a6003820ee0283a8bb/href">https://medium.com/media/69ce50e1141de2a6003820ee0283a8bb/href</a></iframe><h3><strong>Conclusion</strong></h3><p>In this article, we have learnt how easy it is to use <strong>fetch API</strong> to make network request and parse the response. Once we have the result as parsed response, we are showing it on notification.</p><p>Hope you found this story useful and interesting.</p><p>Happy coding! 😃 💻</p><h3><strong>References</strong></h3><ol><li>Harmony OS JS network request: <a href="https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-network-data-request-0000000000626077">https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-network-data-request-0000000000626077</a></li></ol><p>2. Harmony OS JS notification: <a href="https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-system-notification-0000000000626084">https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-system-notification-0000000000626084</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1447c2184ebb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/requesting-network-data-and-showing-notification-in-harmony-os-java-script-1447c2184ebb">Requesting Network Data and showing notification in Harmony OS (Java Script)</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[Track the performance for In-App links using HUAWEI APP LINKING]]></title>
            <link>https://rchancha.medium.com/track-the-performance-for-in-app-links-using-huawei-app-linking-a6f790bc8f7c?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6f790bc8f7c</guid>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[huawei-developers]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Fri, 02 Jul 2021 13:14:31 GMT</pubDate>
            <atom:updated>2021-07-02T13:14:31.327Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>In-App linking is refer to App linking or deep linking in general, however it is particularly for the use case of sharing content with the same application for the same application installed on the android device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*mU9jRycgXz0RVRLJ.png" /></figure><p><strong>Huawei App Linking </strong>leverage developers/users to create cross platform links which can work as defined and can be distributed with multiple channels to users.</p><p>When the user clicks the link, it will be re-directed to the specified in-app content.</p><p><strong>Huawei App Linking </strong>has multiple functions:</p><p><strong>1.</strong> <strong>Support for deferred deep links</strong></p><p><strong>2.</strong> <strong>Link display in card form</strong></p><p><strong>3.</strong> <strong>Data statistics</strong></p><p><strong>Huawei App Linking </strong>supports the link creation in multiple ways:</p><p><strong>1.</strong> <strong>Creating a link in AppGallery Connect</strong></p><p><strong>2.</strong> <strong>Creating a link by calling APIs on the client</strong></p><p><strong>3.</strong> <strong>Manually constructing a link</strong></p><p><strong>Creating a link in AppGallery Connect</strong></p><p>We will be focusing on the Huawei App linking capabilities to create the deep links for our Android application through Huawei AppGallery Connect.</p><p><strong>Use Case</strong></p><p>There could be multiple use cases for this capability, however I will throw some light on a use case which is most commonly adapted by the applications with complex UX and high transmission between different in-app pages.</p><p><strong>Development Overview</strong></p><p>1. Must have a Huawei Developer Account</p><p>2. Must have Android Studio 3.0 or later</p><p>3. Must have a Huawei phone with HMS Core 4.0.2.300 or later</p><p>4. EMUI 3.0 or later</p><p><strong>Software Requirements</strong></p><p>1. Java SDK 1.7 or later</p><p>2. Android 5.0 or later</p><p><strong>Preparation</strong></p><p>1. Create an app or project in Android Studio.</p><p>2. Create an app and project in the <a href="https://developer.huawei.com/consumer/en/service/josp/agc/index.html">Huawei AppGallery Connect</a>.</p><p>3. Provide the SHA Key and App Package name of the project for which you want the App Linking to be done (Example: News application)</p><p>4. Download the <strong>agconnect-services.json</strong> file and paste to the app folder of your android studio.</p><p><strong>Integration</strong></p><ul><li>Add below to <strong>build.gradle (project)file, under </strong>buildscript/repositories and allprojects/repositories.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f0d57be574259733b81e2105ba36222/href">https://medium.com/media/6f0d57be574259733b81e2105ba36222/href</a></iframe><ul><li>Add below to build.gradle (app) file, under dependencies to use the App Linking SDK.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f14aa1842de2429fa4439d7ace41bbf7/href">https://medium.com/media/f14aa1842de2429fa4439d7ace41bbf7/href</a></iframe><p><strong>News Application</strong></p><p>News application is developed with multiple content and complex UX to show the capability of the <strong>Huawei App Linking.</strong></p><p>I will highlight some if the important code blocks for this application.</p><p><strong>Main Activity</strong></p><p>This activity is the entry point for the application which will have the navigation tab to handle the multiple news categories.</p><p>Also, it receives the App Link, read it and re-direct it to the corresponding content.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/754d6dc1335fb536f1399c2f53b6a456/href">https://medium.com/media/754d6dc1335fb536f1399c2f53b6a456/href</a></iframe><p><strong>Creating a link in AppGallery Connect to directly open the Science tab for the News Application through a link</strong></p><p><strong>1.</strong> Login to AppGallery Connect.</p><p><strong>2.</strong> Choose <strong>My Projects &gt; NewsWorld(App Linking).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FhN3pgVvVS6K_d2j.png" /></figure><p><strong>3.</strong> Go to<strong>&gt;Growing</strong> &gt; <strong>App Linking&gt;Enable now</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gqbl-dhqrc4--TRW.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yqQeib7YTy_DKw1F.png" /></figure><p><strong>4.</strong> Once you enable the app linking for your project by setting up the country and region choose<strong> URL prefix&gt;Add URL prefix</strong></p><p>Add URL prefix, which is a free domain name provided by AppGallery Connect with a string.</p><p><strong>Tip: </strong>URL prefix should be unique and can contain only lowercase letters and digits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kybqMFGzDUQ0pbqq.png" /></figure><p>Select <strong>Set domain name option</strong> and then click on<strong> Next </strong>button<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hz9_mGeM0XBpbRFT.png" /></figure><p>The following page will be displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kTXAUgS04hQdh_JC.png" /></figure><p><strong>6. </strong>Click <strong>App Linking</strong> and then click <strong>Create App Linking</strong> for deep linking purpose. It is required to directly navigate to specific in-app content from a different application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nbC5BRHOGIoFtjfj.png" /></figure><p><strong>7. </strong>It will suggest short link by itself or you can customise it as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8vAan9WzfQGp3hJ5.png" /></figure><p><strong>8</strong>. Click on <strong>Next </strong>button and set the deep link.</p><p><strong>App Linking name:</strong> deep link name.</p><p><strong>Default deep link:</strong> deep link used to open an app.</p><p><strong>Android deep link: </strong>deep link preferentially opened on an Android device.</p><p><strong>iOS deep Link URL:</strong> deep link preferentially opened on an iOS device.</p><p><strong>Tip 1: </strong>Link name and Default deep link can be same and follow as <a href="https://domainname.com/xxx">https://domainname.com/xxx</a></p><p>Where “domainname” is URLprefix which we set above and “xxx” is specific in-app content page to re-direct.</p><p><strong>Tip 2:</strong> You can customize the deep link, which is different from the URL prefix of the link.</p><p>Once done, click on<strong> Next </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K4k8PDXfW7pLVWjA.png" /></figure><p><strong>9. </strong>Select <strong>Set Android link behaviour</strong> for your Android application as below.</p><p>We will choose <strong>“Open in app”</strong> as we want our application to open directly as application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PfivI6BInHtVR-t8.png" /></figure><p>Select your application from the <strong>Add Android app</strong> menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pDK05yVUwyaQpczs.png" /></figure><p>Redirect user to AppGallery page if the application is not installed on the device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ell4Db0iVwAsmcrT.png" /></figure><p><strong>Tip:</strong> Ensure that the App Store ID and team ID have been configured. If they are not configured, add them as prompted.</p><p>Once done, click on <strong>Next </strong>button.</p><p><strong>10. </strong>We have set the deep link for our news application and it will re-direct to in-app content tab (science) every time when it is shared from our share application.</p><p>To check the details and use the link we will navigate to <strong>view details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*giIBWnpVd8qhj0Pn.png" /></figure><p><strong>11. </strong>We will use short App link for our App Linking use case. It will re-direct the user to Science tab of news application from our shared link through different tab.</p><p><strong>Receiving Links of App Linking</strong></p><p>When a user is directed to the target content after tapping a received link of App Linking, your app can call the API provided by the App Linking SDK to receive the tapped link and obtain data passed through the link.</p><p><strong>Add an Intent Filter to manifest file</strong></p><p>Add intent filter to activity which will receive and process the link.</p><p>We will add this for Main activity for our use case.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/645dd4aa428fdb059a87d754c68c38cc/href">https://medium.com/media/645dd4aa428fdb059a87d754c68c38cc/href</a></iframe><p><strong>Receive the link in our Main activity</strong></p><p>Add below code to your activity to receive and process the link.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39f2059a6bc4ee7426bc9ede46d0c35c/href">https://medium.com/media/39f2059a6bc4ee7426bc9ede46d0c35c/href</a></iframe><p><strong>Check Statistics for your links</strong></p><p>Huawei App Linking provides lot many additional features to track the statistic for the created in-app links for your application which will be helpful in order to generate the analytical reports and improve the performance.</p><p><strong>Step 1: </strong>Click on<strong> Statistics</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tT6TeNSHQa8mHF0z.png" /></figure><p><strong>Step 2: </strong>Check the performance graph based on the filters</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YwNVSRgh7ijK9zh-.png" /></figure><p><strong>Results</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*Qn4UKyHE37ddhQSa.gif" /></figure><p><strong>Tips and Tricks</strong></p><p><strong>1.</strong> URL prefix should be unique and can contain only lowercase letters and digits.</p><p><strong>2.</strong> Link name and Default deep link can be same and follow as <a href="https://domainname.com/xxx">https://domainname.com/xxx</a></p><p>Where “domainname” is URLprefix which we set above and “xxx” is specific in-app content page to re-direct.</p><p><strong>3.</strong> You can customize the deep link, which is different from the URL prefix of the link.</p><p><strong>4.</strong> Ensure that the App Store ID and team ID have been configured. If they are not configured, add them as prompted.</p><p><strong>Conclusion</strong></p><p>This article focuses explains how in-app links can be created using Huawei App Linking capabilities and use them further for in –app content re-directions for large scale android applications. This article also explains how one can check the statistics for their app links.</p><p><strong>Reference</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction">https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6f790bc8f7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intermediate: Changing App theme using Huawei Dark mode Awareness Service]]></title>
            <link>https://medium.com/huawei-developers/intermediate-changing-app-theme-using-huawei-dark-mode-awareness-service-9e72d04fea6f?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e72d04fea6f</guid>
            <category><![CDATA[awareness-kit]]></category>
            <category><![CDATA[huawei-developers]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[hms-core]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Tue, 25 May 2021 03:56:36 GMT</pubDate>
            <atom:updated>2021-05-25T03:56:36.953Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>In this article, we will use <strong>HMS Dark mode awareness</strong> to support Dark theme in our app.</p><p>As more and more devices supporting dark theme is getting released every month, so Android app need to support dark mode is on the rise. And if you have not already updated your app to support Dark theme, your app could soon appear to be an outdated application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*nJjPf0iYXqkT-6-VE2Hk_Q.gif" /></figure><h3><strong>Development Overview</strong></h3><h4><strong>Prerequisite</strong></h4><p>1. Must have a Huawei Developer Account.</p><p>2. Must have Android Studio 3.0 or later.</p><p>3. Must have Huawei phone running EMUI 5.0 with HMS core version 4.0.2.300.</p><h4><strong>Software Requirements</strong></h4><p>1. Java SDK 1.7 or later.</p><p>2. Android 5.0 or later.</p><h4><strong>Preparation</strong></h4><p>1. Create an app or project in the Huawei AppGallery Connect.</p><p>2. Provide the SHA Key and App Package name of the project in App Information Section and enable the <strong>Awareness Kit</strong> API.</p><p>3. Download the <strong>agconnect-services.json</strong> file.</p><p>4. Create an Android project.</p><h3><strong>Integration</strong></h3><ol><li>Add below to <strong>build.gradle (project) file </strong>under<strong> </strong>buildscript/repositories and allprojects/repositories.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5624a6fe33a1ee68c9a8b63790bbeaa/href">https://medium.com/media/e5624a6fe33a1ee68c9a8b63790bbeaa/href</a></iframe><p>2. Add below to <strong>build.gradle (app)</strong> file, under dependencies to use the <strong>Awareness kit SDK</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7bb79737b83e922e42e696e285a602d/href">https://medium.com/media/d7bb79737b83e922e42e696e285a602d/href</a></iframe><h3><strong>Development</strong></h3><p>We will create a simple UI design which will be shown when dark mode is off.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57b65a8f32989c1accebf624d694b0da/href">https://medium.com/media/57b65a8f32989c1accebf624d694b0da/href</a></iframe><p>For dark theme, we will define a <strong>color.xml</strong> inside qualifier <strong>values-night</strong> in <strong>res </strong>folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2036b36695467a7fd378ade181321d85/href">https://medium.com/media/2036b36695467a7fd378ade181321d85/href</a></iframe><p>Now let us define <strong>style.xml</strong> in <strong>res &gt; values</strong> directory to support dark theme.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6db91b422600ff2b502fc760ad0c5b3/href">https://medium.com/media/e6db91b422600ff2b502fc760ad0c5b3/href</a></iframe><p>We will create drawable-night-xxx directory and add dark theme images into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*qML5d32Aa5TV_5ZPSvwb6A.png" /></figure><p>To check if dark mode is <strong>on/off</strong>, we need to obtain <strong>Capture Client</strong> instance of Awareness kit. Using Capture Client instance, we will call the dark mode status query.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48c04898a54e26f86bea609879831461/href">https://medium.com/media/48c04898a54e26f86bea609879831461/href</a></iframe><p>Based on returned dark mode status, we are setting our app theme.</p><p>Code snippet of <strong>MainActivity.java</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/784a67e8d35f90bda9ca4ce5e948ac3c/href">https://medium.com/media/784a67e8d35f90bda9ca4ce5e948ac3c/href</a></iframe><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*o_RtDjAFgnZ5tt6MucHCYg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*wORq5q1ewDl0T2G4n8TjtQ.jpeg" /></figure><h3><strong>Tips and Tricks</strong></h3><p>1. Minimum SDK version should be <strong>29</strong>.</p><p>2. To enable dark mode, choose <strong>Settings &gt; Display &amp; Brightnes</strong>s and enable <strong>dark mode</strong>.</p><p>3. Dark mode awareness capability will not support for barrier function.</p><h3><strong>Conclusion</strong></h3><p>In this article, we have learnt how easily can change our application theme using HMS dark mode detection. We can check programmatically if dark mode is enabled or not and based on the dark mode awareness query result, we can load our theme.</p><p>Hope you found this story useful and interesting.</p><p>Happy coding! 😃 💻</p><h3><strong>References</strong></h3><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/dark--awareness-0000001053471955">Dark Mode Awareness</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e72d04fea6f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/intermediate-changing-app-theme-using-huawei-dark-mode-awareness-service-9e72d04fea6f">Intermediate: Changing App theme using Huawei Dark mode Awareness Service</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[Intermediate: Huawei Activity Identification Service | HMS location kit]]></title>
            <link>https://rchancha.medium.com/intermediate-huawei-activity-identification-service-hms-location-kit-d0b274a0d8cd?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0b274a0d8cd</guid>
            <category><![CDATA[location-kit]]></category>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[huawei-developers]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 10 May 2021 09:08:35 GMT</pubDate>
            <atom:updated>2021-05-10T09:12:08.866Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Nowadays, everybody is using smartphones to do daily tasks like taking <strong>photos</strong>, looking up movie times, making calls etc. The best part of Android apps on mobile phones is that they are trying more and more to get to know their users. Many applications today take users’ locations to provide users with locational feeds. One common example is a normal news app, where the app takes your current location and shows the news by location.</p><p>If you’re a developer, you need to understand users better to give users a better experience of the application. You should know at any time what your users do. The more you know about your users, the better application for your users can build. For example, a distance calculator app lunches by itself when you start driving yourcar or bike and stops when you stop driving. Health and fitness app also uses this service to determine how many meters/kilometers you have covered on particular day.</p><h3><strong>What is Activity Identification Service?</strong></h3><p>Activity Identification Service does the heavy lifting using <strong>acceleration sensor</strong>, <strong>cellular network information</strong> and <strong>magnetometer</strong> from device to identify user’s current activity. Your app receives a list of detected activities, each of which includes <strong>possibility</strong> and <strong>identity</strong> properties.</p><p>The Activity Identification Service can detect following activities:</p><ul><li><strong>STILL:</strong> When the mobile device will be still, that is, the user is either sitting at someplace or the mobile device is having no motion, then the <strong>Activity Recognition Client</strong> will detect the <strong>STILL</strong> activity.</li><li><strong>FOOT:</strong> When the mobile device is moving at a normal speed , that is, the user carrying the mobile device is either walking or running then the <strong>Activity Identification Service</strong> will detect the <strong>FOOT</strong> activity.</li><li><strong>WALKING:</strong> This is a sub-activity of the <strong>FOOT</strong> activity which is detected by the Activity Identification Service when the user carrying the mobile device is walking.</li><li><strong>RUNNING:</strong> This is also a sub-activity of <strong>FOOT</strong> activity which is detected by the Activity Recognition Client when the user carrying the mobile device is running.</li><li><strong>VEHICLE:</strong> This activity detected when the mobile device is on the <strong>bus</strong> or <strong>car</strong> or some other kind of vehicle or the user holding the mobile device is present in the vehicle.</li><li><strong>OTHERS:</strong> The Activity Identification service will show this result when the device is unable to detect any activity on the mobile device.</li></ul><p>In this article, we will create a sample application to show user activity. When user clicks start button, we will identify user activity status along with possibility level and display the status in <strong>Textview</strong> and <strong>Imageview</strong>. And when user clicks on stop button, we will stop requesting activity identification updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*FukXsCJeMm6RiHQ_wej2jg.png" /></figure><h3><strong>Development Overview</strong></h3><h4><strong>Prerequisite</strong></h4><p>1. Must have a Huawei Developer Account.</p><p>2. Must have Android Studio 3.0 or later.</p><p>3. Must have Huawei phone running EMUI 5.0 or later.</p><p>4. EMUI 5.0 or later.</p><h4><strong>Software Requirements</strong></h4><p>1. Java SDK 1.7 or later.</p><p>2. Android 5.0 or later.</p><h3><strong>Preparation</strong></h3><p>1. Create an app or project in the Huawei App Gallery Connect.</p><p>2. Provide the SHA Key and App Package name of the project in App Information Section and enable the <strong>Location Kit</strong> API.</p><p>3. Download the <strong>agconnect-services.json</strong> file.</p><p>4. Create an Android project.</p><h3><strong>Integration</strong></h3><ol><li>Add below to <strong>build.gradle (project) file under </strong>buildscript/repositories and allprojects/repositories.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f9a991fe1eba1b019878ec97743a085/href">https://medium.com/media/7f9a991fe1eba1b019878ec97743a085/href</a></iframe><p>2. Add below to <strong>build.gradle (app)</strong> file, under dependencies to use the <strong>Location kit SDK</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4d6505889aa6636775affda5e3c27c3/href">https://medium.com/media/e4d6505889aa6636775affda5e3c27c3/href</a></iframe><p><strong>Tip: </strong>Minimum android version supported for these kits is 19.</p><p>3. Add below permissions to <strong>manifest file</strong>.</p><p>For version earlier than android Q</p><p>&lt;uses-permission android:name=”com.huawei.hms.permission.ACTIVITY_RECOGNITION”/&gt;</p><p>For version Android Q and later</p><p>&lt;uses-permission android:name=”android.permission.ACTIVITY_RECOGNITION” /&gt;</p><p><strong>Note</strong>: The above permissions are dangerous permission and need to be requested dynamically. Requesting permission dynamically is not covered in this article.</p><h3><strong>Development</strong></h3><p>We need to register static broadcast receiver in <strong>AndroidManifest.xml </strong>to listen to activity status update identified by <strong>Activity Identification Service</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4741939c87e206a6feb7203b169a373d/href">https://medium.com/media/4741939c87e206a6feb7203b169a373d/href</a></iframe><p>Now the next step is to add the UI for our Main Activity. In our application, we will be having one <strong>TextView </strong>to display the name of the current activity and display corresponding image on <strong>ImageView</strong> and one <strong>TextView </strong>to display the possibility of Activity. We will have two <strong>Buttons</strong> to start and stop activity identification tracking. So, the <strong><em>activity_main.xml</em></strong> file looks something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0fb4b590ef6a36659bcf86d03f9e356/href">https://medium.com/media/e0fb4b590ef6a36659bcf86d03f9e356/href</a></iframe><p>Now let’s create instance of <strong>ActivityIdentificationService</strong> in <strong>onCreate()</strong> method of <strong>MainActivity.java</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65223468720b3c8cc13e2af033d25209/href">https://medium.com/media/65223468720b3c8cc13e2af033d25209/href</a></iframe><p>To obtain PendingIntent object</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6ecc8cac579a8fd3dfda9d734808b03/href">https://medium.com/media/e6ecc8cac579a8fd3dfda9d734808b03/href</a></iframe><p>When user clicks on <strong>Start Tracking</strong> Button, we will request activity identification updates by calling <strong>createActivityIdentificationUpdates()</strong> method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9b84aa2efc5e103da4da9add7512305/href">https://medium.com/media/d9b84aa2efc5e103da4da9add7512305/href</a></iframe><p>This method has two parameters: <strong>detectionIntervalMillis</strong> and <strong>pendingIntent</strong>, which indicate the detection interval (in milliseconds) and action to perform, respectively.</p><p>On click of <strong>Stop Tracking</strong> Button, we will stop activity identification updates.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d2add8b728708f2d20f22afb7e94004/href">https://medium.com/media/8d2add8b728708f2d20f22afb7e94004/href</a></iframe><p>Finally, We can get activity identification result (containing <strong>identity</strong> and <strong>possibility)</strong> from intent received by the broadcast receiver.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37ae8c6f5eb19c2f873d1db21c33f0b4/href">https://medium.com/media/37ae8c6f5eb19c2f873d1db21c33f0b4/href</a></iframe><p><strong>getActivityIdentificationDatas()</strong> API is used to obtain the list of activitiy identification list. The activity identifications are sorted by most probable activity first.</p><p>We have created <strong>Utils.java </strong>class to obtain activity status from identity code obtained from <strong>LocationReceiver</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/890f14e5de39b69dffc8aefb4417af16/href">https://medium.com/media/890f14e5de39b69dffc8aefb4417af16/href</a></iframe><p>Code snippet of <strong>MainActivity.java</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8197d9cbf356ff92432b46cb2383e09/href">https://medium.com/media/a8197d9cbf356ff92432b46cb2383e09/href</a></iframe><p><strong>Tips and Tricks<br></strong>1.During writing of this article, the activity identification service cannot identify the cycling and riding activities on devices outside the Chinese mainland.<br>2. ACTIVITY_RECOGNITION is dangerous permission and should be requested dynamically.</p><p><strong>Conclusion<br></strong>In this article, we have learnt how to use the Activity Identification Service in our application to determine the activities that users are doing at any given time. The Activity Identification Service determines the ongoing activities based on a possibility value that tells you which activity is currently taking place.<br>Hope you found this story useful and interesting.<br>Happy coding! 😃 💻</p><p><strong>References<br></strong>https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/introduction-0000001050706106-V5</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0b274a0d8cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Guide to register Software Copyright Certificates in China]]></title>
            <link>https://medium.com/huawei-developers/the-ultimate-guide-to-register-software-copyright-certificates-in-china-45571448fc9f?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/45571448fc9f</guid>
            <category><![CDATA[huawei-appgallery]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[featured]]></category>
            <category><![CDATA[china]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 03 May 2021 08:26:06 GMT</pubDate>
            <atom:updated>2021-05-03T08:26:06.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4e0AvtKJonxX6qmF.png" /></figure><p><a href="https://medium.com/appgallery/how-to-achieve-success-in-china-app-market-d7dcaf6d78c3">How to achieve success in China app market</a></p><p>When you want to develop your apps in China, do you find that the application environment in China is different from the West and there are strict controls over releasing the apps and games? Or when you submit your apps to the app market, you will be required to provide related qualifications, such as a software copyright certificate. Many foreign companies are unfamiliar with how to record software copyright in China, which is most overseas developers often face, so there is an article about how to obtain the copyright.</p><ul><li><strong>Why do we need to apply for Software Copyright Certificate?</strong></li></ul><p>In China, a Software Copyright Certificate(SCC) refers to the exclusive rights enjoyed by software developers in accordance with the copyright laws and is used to prove and protect the copyright of your mobile app. On the one hand, it’s a necessary certificate for some categories of apps to release in China, because it can prove the ownership of the app to the Chinese app stores. On the other hand, it can prevent your code from plagiarizing or pirating and is an important proof of app infringement.</p><ul><li><strong>Where to apply for Software Copyright Certificate?</strong></li></ul><p>The State Copyright Administration is in charge of the registration of the certificate in China, you can apply for it on the website of China Protection Center of China (http://www.ccopyright.com.cn/). And the applicant may register a software copyright certificate by yourself self or entrust an agency to register the copyright.</p><ul><li><strong>List the detailed process for obtaining Software Copyright Certificate</strong></li></ul><p>For individual registering, the process can be divided into five phases: fill in the application form → submit the application documents →the organization accepts the application →complete the examination → obtain the registration certificate; If you have an agent to help you, just provide the materials directly to the agency or institution, and they will handle the application for you.</p><ul><li><strong>How long does it take to receive a Software Copyright Certificate?</strong></li></ul><p>The organization will complete the application within 30 working days after the application is accepted. So plus the time to prepare the material, it usually takes one to two months to apply for a software copyright certificate for the developers outside China.</p><ul><li><strong>What materials are required to register a Software Copyright Certificate?</strong></li></ul><p>The application documents for software copyright registration shall include:</p><p>Ø Application form for software copyright registration;</p><p>Ø Software identification materials;</p><p>Ø Identity certificate of the applicant;</p><p>Ø Identity certificate of the contact person;</p><ul><li><strong>Answering some questions during the application process</strong></li></ul><p>1. Can I get a Software Copyright Certificate if I’m not a Chinese company?</p><p>Yes, the copyright owner can be a foreign company or legal person, but you must submit the legal proof certified by the local Chinese consulate or notarized by the local notary office.</p><p>2. Why do I need to provide a source code sample to register a Software Copyright Certificate?</p><p>By providing a small sample of your source code, you receive an additional layer of protection, because this small snippet can be used to prove ownership in a copyright dispute. And only part of the source code is required to be provided, there is no need to worry about your code sample being copied by another party.</p><p>3. What are the requirements for the identification documents submitted by foreign companies?</p><p>The identity documents submitted by foreign companies must be certified by Chinese embassies and consulates in the local country. And all foreign language documents must be translated by the translation company and stamped with the official seal of the translation company.</p><p>4. Can the Software Copyright Certificate be transferred or revoked?</p><p>Yes, you need to make the relevant application and registration on the website of the China Protection Center of China.</p><p>For more detail about registering the software copyright certificate to release apps on AppGallery in China, please send an email to <strong>gochina@huawei.com.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45571448fc9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/the-ultimate-guide-to-register-software-copyright-certificates-in-china-45571448fc9f">The Ultimate Guide to register Software Copyright Certificates in China</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[Beginner: Using Lightweight Preference Database in Harmony OS]]></title>
            <link>https://medium.com/huawei-developers/beginner-using-lightweight-preference-database-in-harmony-os-5233c281c7de?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5233c281c7de</guid>
            <category><![CDATA[harmony-os]]></category>
            <category><![CDATA[hms-core]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 19 Apr 2021 09:16:20 GMT</pubDate>
            <atom:updated>2021-04-19T09:16:20.134Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Harmony OS is a future-proof distributed operating system open to you as part of the initiatives for all-scenario strategy, adaptable to <strong>mobile office</strong>, <strong>fitness</strong> and <strong>health</strong>, <strong>social</strong> <strong>communication</strong>, and <strong>media</strong> <strong>entertainment</strong>, to name a few. Unlike a legacy operating system that runs on a standalone device, Harmony OS is built on a distributed architecture designed based on a set of system capabilities. It can run on a wide range of device forms, including <strong>smartphones</strong>, <strong>tablets</strong>, <strong>wearables</strong>, <strong>smart</strong> <strong>TVs</strong> and <strong>head</strong> <strong>units</strong>.</p><p>A lightweight preference database is used to store simple key-value pairs and provides simple method to read and write them.</p><p>In this article, we will create a simple login page for smartwatch to store user’s credential into lightweight preference database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAkPj7Q1vYBvXlXmIjolKg.png" /></figure><h3><strong>Requirements</strong></h3><ol><li>DevEco IDE</li></ol><p>2. Smartwatch wearable simulator</p><h3><strong>Development</strong></h3><p>In order to save and load user’s credential, we need to obtain <strong>Preferences</strong> instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a47bccbaeee2a742815deac4fda38fba/href">https://medium.com/media/a47bccbaeee2a742815deac4fda38fba/href</a></iframe><p>First time when user launches the app, user needs to register. User will enter username and password and click on register to store credential into preference database using <strong>put()</strong> method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc32c35aebcac4eaf6b326150cc97fb3/href">https://medium.com/media/dc32c35aebcac4eaf6b326150cc97fb3/href</a></iframe><p><strong>flushSync()</strong> is used to write preference in file synchronously. To write synchronously, we can use <strong>flush()</strong>.</p><p>When user enters credential and click on login button, app will fetch or query the credential from lightweight preference using <strong>get()</strong> method and compare it with entered credential to validate.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ec9c495b0957abad34ecb4764f347b8/href">https://medium.com/media/0ec9c495b0957abad34ecb4764f347b8/href</a></iframe><p>If validation fails, error message will be shown</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdb3884489f48d57a0dba3c03da6d7ea/href">https://medium.com/media/cdb3884489f48d57a0dba3c03da6d7ea/href</a></iframe><p>Code snippet of <strong>MainAblitySlice.java</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ede043d0806fff55f6ca17f2328ed03c/href">https://medium.com/media/ede043d0806fff55f6ca17f2328ed03c/href</a></iframe><p><strong>ability_main.xml </strong>contains UI design</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60cad0ab0b8b936ff0565549158626e1/href">https://medium.com/media/60cad0ab0b8b936ff0565549158626e1/href</a></iframe><p>We will use <strong>background_ability_main.xml </strong>to<strong> </strong>define background color and shape of DependentLayout in<strong> ability_main.xml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3022ccbd381914279f0c6403c5750eee/href">https://medium.com/media/3022ccbd381914279f0c6403c5750eee/href</a></iframe><p><strong>background_text_field.xml</strong> is used to define shape and background color of textfield.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f07636ae02d79c54888ae97a73e45852/href">https://medium.com/media/f07636ae02d79c54888ae97a73e45852/href</a></iframe><p>We have defined style for text field to display error in <strong>background_text_field_error.xml</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ead502dde17bd37c4bbdca7824f4fee0/href">https://medium.com/media/ead502dde17bd37c4bbdca7824f4fee0/href</a></iframe><h3><strong>Tips and Tricks</strong></h3><p>1. <strong>flush() </strong>and <strong>flushsync()</strong> is used to write data asynchronously and synchronously respectively.</p><p>2. To obtain the <strong>targetContext</strong> and <strong>srcContext </strong>in the preceding code, call the <strong>getApplicationContext()</strong> method in the <strong>AbilitySlice</strong> or <strong>Ability</strong> class.</p><h3><strong>Conclusion</strong></h3><p>This article is focused on Harmony OS lightweight preferences database which is very helpful for storing light weight data. This article explains the integration of preferences into simple login app for smartwatch to store user’s credential.</p><p>If you found this tutorial helpful, then help us by SHARING this post. Thank You!</p><h3><strong>Reference</strong></h3><p><a href="https://developer.harmonyos.com/en/docs/documentation/doc-guides/harmonyos-overview-0000000000011903">Harmony Official document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5233c281c7de" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/beginner-using-lightweight-preference-database-in-harmony-os-5233c281c7de">Beginner: Using Lightweight Preference Database in Harmony OS</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[Obtaining Device Information in Harmony OS Lite wearable]]></title>
            <link>https://medium.com/huawei-developers/obtaining-device-information-in-harmony-os-lite-wearable-15d9ba49c527?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/15d9ba49c527</guid>
            <category><![CDATA[huawei-developers]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[huawei-watch]]></category>
            <category><![CDATA[harmony-os]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 01 Feb 2021 06:03:23 GMT</pubDate>
            <atom:updated>2021-02-01T06:03:23.255Z</atom:updated>
            <content:encoded><![CDATA[<h4>Harmony OS is a future-proof distributed operating system open to you as part of the initiatives for the all-scenario strategy, adaptable to <strong>mobile office</strong>, <strong>fitness</strong> and <strong>health</strong>, <strong>social</strong> <strong>communication</strong>, and <strong>media</strong> <strong>entertainment</strong>, to name a few.</h4><p>Unlike a legacy operating system that runs on a standalone device, Harmony OS is built on a distributed architecture designed based on a set of system capabilities. It can run on a wide range of device forms, including <strong>smartphones</strong>, <strong>tablets</strong>, <strong>wearables</strong>, <strong>smart</strong> <strong>TVs</strong> and <strong>head</strong> <strong>units</strong>.</p><p>In this article, we will create simple lite wearable JS application to obtain device information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*wGSwMUnm66GrXNDDB23LWw.gif" /></figure><h3><strong>Requirements</strong></h3><p>1) DevEco IDE</p><p>2) Lite wearable simulator</p><h3><strong>Implementation</strong></h3><p>First page, <strong>index.hml </strong>contains <strong>&lt;swiper&gt;</strong> container that enables the switch of child components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86a843331e5e577f0f8581e297f05075/href">https://medium.com/media/86a843331e5e577f0f8581e297f05075/href</a></iframe><p><strong>index.css</strong> has style defined for the page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b20d57e9dfedb90c1274c0d1a0903a8/href">https://medium.com/media/4b20d57e9dfedb90c1274c0d1a0903a8/href</a></iframe><p>First, we need to import the <strong>device</strong> module in <strong>index.js</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7230bd79309c69c7f7b2dab168fdbe9/href">https://medium.com/media/e7230bd79309c69c7f7b2dab168fdbe9/href</a></iframe><p>To obtain the device information, we will call <strong>device.info()</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bcfe77204b68ffb5bebd17f18f510a6/href">https://medium.com/media/0bcfe77204b68ffb5bebd17f18f510a6/href</a></iframe><p>Code Snippet of <strong>index.js</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cdd2a720dad3165b4fc19b8d811628f/href">https://medium.com/media/6cdd2a720dad3165b4fc19b8d811628f/href</a></iframe><h3><strong>Tips and Tricks</strong></h3><p>Not all the information can be obtained on simulator. Hence it is recommended to use physical Harmony OS wearable watch.</p><h3><strong>Conclusion</strong></h3><p>In this article, we learnt how easily we can obtain wearable device information such as <strong>brand</strong>, <strong>product</strong>, <strong>device</strong> <strong>dimension</strong>, <strong>density</strong>, etc.</p><h3><strong>References</strong></h3><ul><li><strong>Harmony Official document — </strong><a href="https://developer.harmonyos.com/en/docs/documentation/doc-guides/harmonyos-overview-0000000000011903">https://developer.harmonyos.com/en/docs/documentation/doc-guides/harmonyos-overview-0000000000011903</a></li><li><strong>Harmony OS JS API : </strong><a href="https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-overview-0000001056361791">https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-overview-0000001056361791</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15d9ba49c527" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/obtaining-device-information-in-harmony-os-lite-wearable-15d9ba49c527">Obtaining Device Information in Harmony OS Lite wearable</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[Pedometer implementation using Harmony OS Lite wearable]]></title>
            <link>https://medium.com/huawei-developers/pedometer-implementation-using-harmony-os-lite-wearable-3d942417b9e3?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d942417b9e3</guid>
            <category><![CDATA[huawei-developers]]></category>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[huawei-appgallery]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[harmony-os]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 06:15:33 GMT</pubDate>
            <atom:updated>2021-01-18T06:15:33.538Z</atom:updated>
            <content:encoded><![CDATA[<h4>Harmony OS is a future-proof distributed operating system open to you as part of the initiatives for the all-scenario strategy, adaptable to <strong>mobile office</strong>, <strong>fitness</strong> and <strong>health</strong>, <strong>social</strong> <strong>communication</strong>, and <strong>media</strong> <strong>entertainment</strong>, to name a few.</h4><p>Unlike a legacy operating system that runs on a standalone device, Harmony OS is built on a distributed architecture designed based on a set of system capabilities. It is able to run on a wide range of device forms, including smartphones, tablets, wearables, smart TVs and head units.</p><p>In this article, we will create a simple pedometer application for lite wearable which will count each step user takes, distance covered and Heart rate. Also, for every <strong>1000</strong> steps completion, wearable device will vibrate.</p><p>Pedometer app will have <strong>2</strong> UI screens, first screen will have start button. Once user clicks on <strong>Start</strong> button, app will route to second screen which will show STEPS, BPM (heart rate) and METER/KM (total distance) covered.</p><figure><img alt="Harmony OS" src="https://cdn-images-1.medium.com/max/951/1*a6qQBRIQ6ink9OmRJSfwcQ.png" /></figure><h3><strong>Requirements</strong></h3><p>1) DevEco IDE</p><p>2) Lite wearable simulator (or lite wearable watch)</p><h3><strong>Implementation</strong></h3><p>First page, <strong>index.hml </strong>contains start button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6aca0028e268e973979d323c68201d49/href">https://medium.com/media/6aca0028e268e973979d323c68201d49/href</a></iframe><p><strong>index.css</strong> has style defined for first page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f859d46068fba2c5d1bd30e5783d442/href">https://medium.com/media/6f859d46068fba2c5d1bd30e5783d442/href</a></iframe><p><strong>index.js</strong> contains the implementation of start button. Once user clicks on start button, app will route to second page <strong>stepcounter.hml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84009c70a08d2c1b6308007a7f975fb1/href">https://medium.com/media/84009c70a08d2c1b6308007a7f975fb1/href</a></iframe><p>Second page, <strong>stepcounter.hml </strong>contains UI design for displaying step count, heart beat count and total distance covered.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ab2ba89ca3ae4271ffc4950ce86469a/href">https://medium.com/media/5ab2ba89ca3ae4271ffc4950ce86469a/href</a></iframe><p><strong>stepcounter.css</strong> has style defined for second page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fba083919911e895c9f33c4a28bc355d/href">https://medium.com/media/fba083919911e895c9f33c4a28bc355d/href</a></iframe><p><strong>stepcounter.js</strong> has implementation of various APIs.</p><p>1. Body state API</p><p>This API is used to listen for changes of the sensor wearing state. We will use this API to know if user is wearing wearable device or not.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/407badae940dae2c0eff44abb300099e/href">https://medium.com/media/407badae940dae2c0eff44abb300099e/href</a></iframe><p>2. Heart Rate API</p><p>If body state API returns true, we will call heart rate API.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39aa84f51bb9869f32defa0e0456b5fe/href">https://medium.com/media/39aa84f51bb9869f32defa0e0456b5fe/href</a></iframe><p>3. Step counter API</p><p>This API is used to listen for changes of step counter sensor data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ca322580a001c73c60b13d72e3d872e/href">https://medium.com/media/9ca322580a001c73c60b13d72e3d872e/href</a></iframe><p>4. Vibration API</p><p>This API is used to trigger device vibration. For every completion of <strong>1000</strong> steps, we will call this API to vibrate wearable device.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/92b7887a553954c38eac69ed25e53273/href">https://medium.com/media/92b7887a553954c38eac69ed25e53273/href</a></iframe><p>To calculate the distance covered , we will just multiple each step with 0.762 meter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06c85951b1e3d47527a9be1255fae63e/href">https://medium.com/media/06c85951b1e3d47527a9be1255fae63e/href</a></iframe><p>Finally, we need to unsubscribe all sensor APIs on <strong>onDestroy()</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ebd3e1edac5ce721d37f85cb752cf64/href">https://medium.com/media/5ebd3e1edac5ce721d37f85cb752cf64/href</a></iframe><p><strong>stepcounter.js </strong>code snippet:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f763a4dfad4b2b53560892c899357503/href">https://medium.com/media/f763a4dfad4b2b53560892c899357503/href</a></iframe><h3><strong>Permissions</strong></h3><p>If you are using real wearable device, we need to provide following permissions for Step counter and heart rate in <strong>config.json</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b213630f52b03807810fd9d880e25ea/href">https://medium.com/media/4b213630f52b03807810fd9d880e25ea/href</a></iframe><h3><strong>Tips and Tricks</strong></h3><p>If you are using simulator for development, you can define the sensor data by clicking hamburger menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/0*KW6iBwUB4nUkUInt.png" /></figure><h3><strong>Conclusion</strong></h3><p>In this article, we have learnt how to create simple pedometer app using various sensor APIs such as <strong>Step</strong> <strong>counter</strong>, <strong>Heart</strong> <strong>rate</strong> , <strong>On-body</strong> <strong>state</strong> and <strong>vibrator</strong> provided by harmony OS.</p><h3><strong>References</strong></h3><ul><li>Harmony Official document<strong> — </strong><a href="https://developer.harmonyos.com/en/docs/documentation/doc-guides/harmonyos-overview-0000000000011903">https://developer.harmonyos.com/en/docs/documentation/doc-guides/harmonyos-overview-0000000000011903</a></li><li>Harmony OS JS API — <a href="https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-overview-0000001056361791">https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-overview-0000001056361791</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d942417b9e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/pedometer-implementation-using-harmony-os-lite-wearable-3d942417b9e3">Pedometer implementation using Harmony OS Lite wearable</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[HMS Scan kit Integration into Ionic Application | Installation and Example]]></title>
            <link>https://medium.com/huawei-developers/hms-scan-kit-integration-into-ionic-application-installation-and-example-1cc3304db8da?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cc3304db8da</guid>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[scan-kit]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[hms-scan-kit]]></category>
            <category><![CDATA[cross-platform]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 06:11:02 GMT</pubDate>
            <atom:updated>2022-03-04T07:26:08.272Z</atom:updated>
            <content:encoded><![CDATA[<h4>Use Huawei Scan kit in-app scanner and generator for 1D and 2D barcodes to equip your app for real-world usage.</h4><figure><img alt="Huawei Scan kit" src="https://cdn-images-1.medium.com/max/612/0*5lbgejWktImOEJOo.png" /></figure><h3><strong>Introduction</strong></h3><p>In this article, we will practice how to build a different view mode using <strong>HMS Scan SDK</strong>.</p><p>HUAWEI Scan Kit scans and parses all major <strong>1D</strong> and <strong>2D</strong> barcodes and generates <strong>QR</strong> codes, helping you quickly build barcode scanning functions into your apps.</p><p>HUAWEI Scan Kit automatically <strong>detects</strong>, <strong>magnifies</strong>, and <strong>identifies</strong> <strong>barcodes</strong> from a distance, and is also able to scan a very small barcode in the same way.</p><h3><strong>Scanning Barcodes</strong></h3><p>HMS Scan Kit can be called in multiple ways. You can choose any mode which suits your requirements best.</p><p>1. Default View Mode</p><p>This view mode is provided by HMS scan kit. You do not need to worry about designing a UI as Scan Kit provides one.</p><p>2. Customize View Mode</p><p>Custom view is literally designing a unique camera view layout for your apps which allows you to:</p><ul><li>Beautify your UI</li><li>Improve user-experience</li><li>Customize colours and theme</li><li>Add Flash Button</li></ul><p>3. Bitmap Mode</p><p>In Bitmap mode, barcodes can be scanned using the camera or from images, which you can specify when calling the scanning API. If you choose to scan barcodes using the camera, camera control capabilities required for scanning need to be developed by yourself. For the two barcode scanning ways, Scan Kit provides optimized scanning algorithms. Choosing the one that suits your needs best will provide you with the best experience.</p><h3><strong>Prerequisites</strong></h3><ol><li>Before installing Site Kit, you should have installed <strong>npm</strong>,<strong> Node.js</strong>, <strong>ionic CLI</strong>. To install ionic in system use below command.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab6d82ef1f9f6ed62778fe6900369377/href">https://medium.com/media/ab6d82ef1f9f6ed62778fe6900369377/href</a></iframe><p>2. Generate a Signing Certificate Fingerprint. For generating the SHA key, refer this <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/config-agc-0000001051053460#EN-US_TOPIC_0000001051053460__section17150556890">article</a>.</p><p>3. Create an app in the Huawei AppGallery connect and enable Site Kit in Manage API section. Provide the SHA Key in App Information Section.</p><p>4. Provide storage location.</p><p>5. Download the <strong>agconnect-services.json</strong>.</p><h3><strong>Installation</strong></h3><ol><li>Open windows CMD or terminal, and create ionic project.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/deeae9c84fa48afce378aaf443bdba54/href">https://medium.com/media/deeae9c84fa48afce378aaf443bdba54/href</a></iframe><p>2. Download<a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Library-V1/cordova-sdk-download-0000001057360296-V1"> Cordova Scan kit</a> plugin. Navigate to your project root directory and install plugin using npm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/311db15c58b86bca0ca342cff77e865f/href">https://medium.com/media/311db15c58b86bca0ca342cff77e865f/href</a></iframe><p>3. Install <strong>@ionic-native/core</strong> in your project for full ionic support with completion code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c85ae9e84cd2cfad4be6b129ff5268db/href">https://medium.com/media/c85ae9e84cd2cfad4be6b129ff5268db/href</a></iframe><p>4. Copy the “<strong>node_modules\@hmscore\cordova-plugin-hms-map\ionic\wrapper\dist\hms-scan</strong>” folder to “<strong>node_modules/@ionic-native</strong>” folder under your Ionic project.</p><p>5. Compile the project.</p><p>ionic build<br>npx cap init [appName] [appId]</p><p>where appId is package name.</p><p>6. After this command, you should add platform to the project. To add, follow command below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc7994d163e3ad6d3d70327a8accade0/href">https://medium.com/media/bc7994d163e3ad6d3d70327a8accade0/href</a></iframe><p>7. Add <strong>agconnect-services.json</strong> and <strong>signing certificate jks file</strong> to the app directory in your Android project as show below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/0*fA3tJN6Q99VKkyGt.png" /></figure><p>8. Add maven repository and agconnect service dependencies in root level build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09a902d619c5716ad826dd3683c09ef8/href">https://medium.com/media/09a902d619c5716ad826dd3683c09ef8/href</a></iframe><p>9. Add plugin and scan kit dependency to the app-level <strong>build.gradle</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fee7d4159e874151c572e8d051433d99/href">https://medium.com/media/fee7d4159e874151c572e8d051433d99/href</a></iframe><p>10. Now sync the project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32c9a242def3927e0907ce09eddf2fb5/href">https://medium.com/media/32c9a242def3927e0907ce09eddf2fb5/href</a></iframe><p>11. Import HmsScan in app_module.ts and add it in provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a32fcdb603fc896ae868927b1ddd6dc/href">https://medium.com/media/7a32fcdb603fc896ae868927b1ddd6dc/href</a></iframe><h3><strong>Implementation</strong></h3><p>When app is launched, first screen will have 3 buttons for scanning. <strong>DefaultView</strong> mode, <strong>CustomizeView</strong> Mode and <strong>Bitmap</strong> Mode.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6d1a6da3dc95a078c3f62bbb955b161/href">https://medium.com/media/a6d1a6da3dc95a078c3f62bbb955b161/href</a></iframe><p>Let us see implementation now.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83fdd0ff17d7cb7495ef00897848709f/href">https://medium.com/media/83fdd0ff17d7cb7495ef00897848709f/href</a></iframe><p><strong>permissionGranted()</strong> method is called when app is launched to get camera and external storage permission from user. Once permission is granted, user can use different modes to scan barcodes.</p><p>If scan results contain any URL or link, we will open it in external browser.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/648b2f2ed2cb9e00f619756b1e555b8d/href">https://medium.com/media/648b2f2ed2cb9e00f619756b1e555b8d/href</a></iframe><p><strong>Congratulations</strong>!! You have implemented different view modes for scanning barcode using HMS Scan kit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*i1Vr3fPFQmaqDS8Ep0R6Ow.gif" /></figure><h3><strong>Conclusion</strong></h3><p>As you can see, it is very simple to use Huawei Mobile Service Scan kit with Ionic. You can develop very wonderful barcode scanner app which can be used in <strong>stores, markets, notaries, education, ticket purchases, health institutions</strong>, and even <strong>street vendors</strong> in short, almost all institutions and organizations.</p><h3><strong>References</strong></h3><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides-V1/introduction-0000001057398487-V1">Huawei Scan kit</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cc3304db8da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/hms-scan-kit-integration-into-ionic-application-installation-and-example-1cc3304db8da">HMS Scan kit Integration into Ionic Application | Installation and Example</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[HMS Site kit Integration into Ionic Application | Installation and Example]]></title>
            <link>https://rchancha.medium.com/hms-site-kit-integration-into-ionic-application-installation-and-example-15396ca953f0?source=rss-1b1200c53a3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/15396ca953f0</guid>
            <category><![CDATA[huawei-developers]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <dc:creator><![CDATA[RChancha]]></dc:creator>
            <pubDate>Fri, 08 Jan 2021 06:27:36 GMT</pubDate>
            <atom:updated>2021-01-08T06:27:36.556Z</atom:updated>
            <content:encoded><![CDATA[<h4>Huawei Site Kit directs users to the location-based service they need makes your app accessible to more people. Give your users the power to explore their world.</h4><p>Huawei Site Kit is a development kit for Android applications that provides location search functions like auto-completing keywords, searching for places and providing the details of places. With integrating of this kit into your application, you can search for a destination with keywords including location types like <strong>restaurants</strong>, <strong>hotels</strong>, <strong>hospitals</strong> and <strong>500+ more</strong>, and provide detailed information including <strong>rating</strong>, <strong>address</strong> and <strong>phone number</strong> of the place.</p><p>You can benefit from Huawei Site Kit’s database by sending queries to its Web API. More than 130 million locations and its detailed information are accessible with easy to use API. All of these services and more is also supported in 13 languages, and 200+ countries.</p><figure><img alt="Huawei Site kit" src="https://cdn-images-1.medium.com/max/1024/0*c8ui6nvaag1Ed7gX.jpg" /></figure><h3><strong>Usecase</strong></h3><p>We will use Huawei site kit to search for nearby places based on query entered on search bar. Once we have nearby places, we will show them on Map.</p><p>To learn how to show places on Map, refer this post.</p><p><a href="https://medium.com/huawei-developers/hms-map-integration-into-ionic-application-installation-and-example-97d3d3e34cb1">HMS Map Integration into Ionic Application | Installation and Example</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*HusxP-h9Ci1Ac1KoPTIYIw.gif" /></figure><h3><strong>Prerequisites</strong></h3><ol><li>Before installing Site Kit, you should have installed npm, Node.js, ionic CLI. To install ionic in system use below command.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/407f0eb7f4ec19e8e65d085f7eca5008/href">https://medium.com/media/407f0eb7f4ec19e8e65d085f7eca5008/href</a></iframe><p>2. Generate a Signing Certificate Fingerprint. For generating the SHA key, refer this <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/config-agc-0000001051053460#EN-US_TOPIC_0000001051053460__section17150556890">article</a>.</p><p>3. Create an app in the Huawei AppGallery connect and enable Site Kit in Manage API section. Provide the SHA Key in App Information Section.</p><p>4. Provide storage location.</p><p>5. Download the <strong>agconnect-services.json</strong>.</p><h3><strong>Installation</strong></h3><ol><li>Open windows CMD or terminal, and create ionic project.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e36b9b96298e706577ffc7b5cc6e5bf/href">https://medium.com/media/1e36b9b96298e706577ffc7b5cc6e5bf/href</a></iframe><p>2. Download <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Library-V1/cordova-sdk-download-0000001050426037-V1">Cordova Site kit</a> plugin. Navigate to your project root directory and install plugin using npm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8413fd64bdfcc7e0ee7c6acc29391bcb/href">https://medium.com/media/8413fd64bdfcc7e0ee7c6acc29391bcb/href</a></iframe><p>3. Install <strong>@ionic-native/core</strong> in your project for full ionic support with completion code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/386ca3f841e713cd95acb5198616a6f5/href">https://medium.com/media/386ca3f841e713cd95acb5198616a6f5/href</a></iframe><p>4. Copy the “<strong>node_modules\@hmscore\cordova-plugin-hms-map\ionic\dist\hms-map</strong>” folder to “<strong>node_modules/@ionic-native</strong>” folder under your Ionic project.</p><p>5. Compile the project.</p><p>ionic build<br>npx cap init [appName] [appId]</p><p>where appId is package name.</p><p>6. After this command, you should add platform to the project. To add, follow command.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/abc59d4c3a659a8b7cef25695614fbbb/href">https://medium.com/media/abc59d4c3a659a8b7cef25695614fbbb/href</a></iframe><p>7. Add <strong>agconnect-services.json</strong> and <strong>signing certificate jks file</strong> to the app directory in your Android project as show below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/0*FlP_6c5pjViEhmXy.png" /></figure><p>8. Add maven repository address and agconnect service dependencies in root level build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44128aaedfc6663e46c67abbfc46112a/href">https://medium.com/media/44128aaedfc6663e46c67abbfc46112a/href</a></iframe><p>9. Add signing certificate configuration information in app-level build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fd40905e07e9f550ede92f781c2e079/href">https://medium.com/media/7fd40905e07e9f550ede92f781c2e079/href</a></iframe><p>10. Add plugin to the app-level <strong>build.gradle</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1b7645f0ae124f278703662af7e308/href">https://medium.com/media/bf1b7645f0ae124f278703662af7e308/href</a></iframe><p>11. Add Site kit dependency in app-level build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5488d063a6017d1000f3d6936868d8e9/href">https://medium.com/media/5488d063a6017d1000f3d6936868d8e9/href</a></iframe><p>12. Sync the project</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2304baf8c79c5c18af42bd7b5212d674/href">https://medium.com/media/2304baf8c79c5c18af42bd7b5212d674/href</a></iframe><p>13. Import <strong>HmsSite</strong> in <strong>app_module.ts</strong> and add it inside provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b125b992f34b2af22d98ec8db1b65f16/href">https://medium.com/media/b125b992f34b2af22d98ec8db1b65f16/href</a></iframe><h3><strong>Development</strong></h3><ol><li>To initialize HMSSite Service, we need to call <strong>intializeService</strong> method.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0f72060c8f4e1a8e08e5bf35a04271b/href">https://medium.com/media/d0f72060c8f4e1a8e08e5bf35a04271b/href</a></iframe><p><strong>apiKey</strong> can be found in the agconnect-services.json.</p><p>2. Use <strong>nearbySearch</strong> method to search nearby places.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8dadeb5eb8360eadfbfb6efefd17d6f0/href">https://medium.com/media/8dadeb5eb8360eadfbfb6efefd17d6f0/href</a></iframe><h3><strong>Code Snippet</strong></h3><p><strong>home.page.ts</strong> contains the business logic to show nearby search places using site kit on map.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5b9d0bdf9349af1a7842ed7da023376/href">https://medium.com/media/a5b9d0bdf9349af1a7842ed7da023376/href</a></iframe><p><strong>home.page.html</strong> contains UI design</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aec8170397829d6a8a05e47e3830df78/href">https://medium.com/media/aec8170397829d6a8a05e47e3830df78/href</a></iframe><h3><strong>Conclusion</strong></h3><p>As you can see, it is so simple to use Huawei site kit with Ionic. We have combined our app with Map kit and build an app to show nearby search places on map using marker. You can use site kit services like <strong>place search</strong>, <strong>place details</strong>, <strong>widget search</strong>, etc. too and build much more comprehensive applications to show more than 130 million destinations all around the world on Map.</p><h3><strong>References</strong></h3><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/introduction-0000001050260022">Huawei site kit</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15396ca953f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>