<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jackson</title>
    <description>The latest articles on DEV Community by Jackson (@jacksssson).</description>
    <link>https://dev.to/jacksssson</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F422856%2F1e348235-8bb2-434d-947c-4716bed0e3fe.png</url>
      <title>DEV Community: Jackson</title>
      <link>https://dev.to/jacksssson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacksssson"/>
    <language>en</language>
    <item>
      <title>How I Created a Smart Video Clip Extractor</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Fri, 12 Aug 2022 02:20:43 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-i-created-a-smart-video-clip-extractor-2516</link>
      <guid>https://dev.to/hmosdevelopers/how-i-created-a-smart-video-clip-extractor-2516</guid>
      <description>&lt;p&gt;Travel and life vlogs are popular among app users: Those videos are telling, covering all the most attractive parts in a journey or a day. To create such a video first requires great editing efforts to cut out the trivial and meaningless segments in the original video, which used to be a thing of video editing pros.&lt;/p&gt;

&lt;p&gt;This is no longer the case. Now we have an array of intelligent mobile apps that can help us automatically extract highlights from a video, so we can focus more on spicing up the video by adding special effects, for example. I opted to use the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Media-Guides/ai_algorithm_integration-0000001166552824#section15938131182814?ha_source=hms3" rel="noopener noreferrer"&gt;highlight capability&lt;/a&gt; from Video Editor Kit to create my own vlog editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;This capability assesses how appealing video frames are and then extracts the most suitable ones. To this end, it is said that the capability takes into consideration the video properties most concerned by users, a conclusion that is drawn from survey and experience assessment from users. On the basis of this, the highlight capability develops a comprehensive frame assessment scheme that covers various aspects. For example:&lt;/p&gt;

&lt;p&gt;Aesthetics evaluation. This aspect is a data set built upon composition, lighting, color, and more, which is the essential part of the capability.&lt;/p&gt;

&lt;p&gt;Tags and facial expressions. They represent the frames that are detected and likely to be extracted by the highlight capability, such as frames that contain people, animals, and laughter.&lt;/p&gt;

&lt;p&gt;Frame quality and camera movement mode. The capability discards low-quality frames that are blurry, out-of-focus, overexposed, or shaky, to ensure such frames will not impact the quality of the finished video. Amazingly, despite all of these, the highlight capability is able to complete the extraction process in just 2 seconds.&lt;/p&gt;

&lt;p&gt;See for yourself how the finished video by the highlight capability compares with the original video.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2rxmzqoop559al57owta.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2rxmzqoop559al57owta.gif" alt="Image description" width="315" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Backing Technology
&lt;/h2&gt;

&lt;p&gt;The highlight capability stands out from the crowd by adopting models and a frame assessment scheme that are iteratively optimized. Technically and specifically speaking:&lt;/p&gt;

&lt;p&gt;The capability introduces &lt;strong&gt;AMediaCodec&lt;/strong&gt; for hardware decoding and Open Graphics Library (OpenGL) for rendering frames and automatically adjusting the frame dimensions according to the screen dimensions. The capability algorithm uses multiple neural network models. In this way, the capability checks the device model where it runs and then automatically chooses to run on NPU, CPU, or GPU. Consequently, the capability delivers a higher running performance.&lt;/p&gt;

&lt;p&gt;To provide the extraction result more quickly, the highlight capability uses the two-stage algorithm of sparse sampling to dense sampling, checks how content distributed among numerous videos, and adopts the frame buffer. All these contribute to a higher efficiency of determining the most attractive video frames. To ensure high performance of the algorithm, the capability adopts the thread pool scheduling and producer-consumer model, to ensure that the video decoder and models can run at the same time.&lt;/p&gt;

&lt;p&gt;During the sparse sampling stage, the capability decodes and processes some (up to 15) key frames in a video. The interval between the key frames is no less than 2 seconds. During the dense sampling stage, the algorithm picks out the best key frame and then extracts frames before and after to further analyze the highlighted part of the video.&lt;/p&gt;

&lt;p&gt;The extraction result is closely related to the key frame position. The processing result of the highlight capability will not be ideal when the sampling points are not dense enough because, for example, the video does not have enough key frames or the duration is too long (greater than 1 minute). For the capability to deliver optimal performance, it recommends that the duration of the input video be less than 60 seconds.&lt;/p&gt;

&lt;p&gt;Let's now move on to how this capability can be integrated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Process
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Preparations
&lt;/h3&gt;

&lt;p&gt;Make necessary preparations before moving on to the next part. Required steps include:&lt;/p&gt;

&lt;p&gt;i. Configure the app information in AppGallery Connect.&lt;/p&gt;

&lt;p&gt;ii. Integrate the SDK of HMS Core.&lt;/p&gt;

&lt;p&gt;iii. Configure obfuscation scripts.&lt;/p&gt;

&lt;p&gt;iv. Declare necessary permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up the Video Editing Project
&lt;/h3&gt;

&lt;p&gt;i. Configure the app authentication information by using either an access token or API key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Method 1: Call &lt;strong&gt;setAccessToken&lt;/strong&gt; to set an access token, which is required only once during app startup.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setAccessToken("your access token");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Method 2: Call &lt;strong&gt;setApiKey&lt;/strong&gt; to set an API key, which is required only once during app startup.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setApiKey("your ApiKey");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. Set a License ID.&lt;/p&gt;

&lt;p&gt;This ID is used to manage the usage quotas of Video Editor Kit and must be unique.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setLicenseId("License ID");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the runtime environment of &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When creating a video editing project, we first need to create an instance of &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; and initialize its runtime environment. When you exit the project, the instance shall be released.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an instance of &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Determine the layout of the preview area.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Such an area renders video images, and this is implemented by &lt;strong&gt;SurfaceView&lt;/strong&gt; within the fundamental capability SDK. Before the area is created, we need to specify its layout.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;LinearLayout    
    android:id="@+id/video_content_layout"    
    android:layout_width="0dp"    
    android:layout_height="0dp"    
    android:background="@color/video_edit_main_bg_color"    
    android:gravity="center"    
    android:orientation="vertical" /&amp;gt;
// Specify a preview area.
LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);

// Design the layout of the area.
editor.setDisplay(mSdkPreviewContainer);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the runtime environment. If the license verification fails, &lt;strong&gt;LicenseException&lt;/strong&gt; will be thrown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;​​​​​​​After the &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; instance is created, it will not use any system resources, and we need to manually set the initialization time for the runtime environment. Then, the fundamental capability SDK will internally create necessary threads and timers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
        editor.initEnvironment();
   } catch (LicenseException error) { 
        SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());    
        finish();
        return;
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Integrating the Highlight Capability
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Create an object that will be processed by the highlight capability.
HVEVideoSelection hveVideoSelection = new HVEVideoSelection();
// Initialize the engine of the highlight capability.
hveVideoSelection.initVideoSelectionEngine(new HVEAIInitialCallback() {
        @Override
        public void onProgress(int progress) {
        // Callback when the initialization progress is received.
        }
        @Override
        public void onSuccess() {
            // Callback when the initialization is successful.
        }

        @Override
        public void onError(int errorCode, String errorMessage) {
            // Callback when the initialization failed.
        }
});

// After the initialization is successful, extract the highlighted video. filePath indicates the video file path, and duration indicates the desired duration for the highlighted video.
hveVideoSelection.getHighLight(filePath, duration, new HVEVideoSelectionCallback() {
        @Override
        public void onResult(long start) {
            // The highlighted video is successfully extracted.
        }
});

// Release the highlight engine.
hveVideoSelection.releaseVideoSelectionEngine();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The vlog has been playing a vital part in this we-media era since its appearance. In the past, there were just a handful of people who could create a vlog, because the process of picking out the most interesting part from the original video could be so demanding.&lt;/p&gt;

&lt;p&gt;Thanks to smart mobile app technology, even video editing amateurs can now create a vlog because much of the process can be completed automatically by an app with the function of highlighted video extraction.&lt;/p&gt;

&lt;p&gt;The highlight capability from the Video Editor Kit is one such function. This capability introduces a set of features to deliver incredible results, such as &lt;strong&gt;AMediaCodec&lt;/strong&gt;, OpenGL, neural networks, a two-stage algorithm (sparse sampling to dense sampling), and more. This capability can help create either a highlighted video extractor or build a highlighted video extraction feature in an app.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>ai</category>
    </item>
    <item>
      <title>Scenario-Based Subscription Gives Users Key Insight on Health and Fitness</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Fri, 12 Aug 2022 01:27:13 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/scenario-based-subscription-gives-users-key-insight-on-health-and-fitness-1fm0</link>
      <guid>https://dev.to/hmosdevelopers/scenario-based-subscription-gives-users-key-insight-on-health-and-fitness-1fm0</guid>
      <description>&lt;p&gt;Many health and fitness apps provide a data subscription feature, which allows users to receive notifications in real time within the app, once their fitness or health records are updated, such as the day's step count, heart rate, or running distance.&lt;/p&gt;

&lt;p&gt;However, tracking health and fitness over the long haul is not so easy. Real time notifications are less useful here. This can be a common challenge for fitness and health tracking apps, as meeting specific goals is not conducive for thinking over a long term. I have encountered this issue in my own fitness app. Let us say that a user of my app is trying to make an exercise plan. They set a long-term goal of walking for 10,000 steps for three times a week. When the step goal is achieved for the current day, my app will send a message with the day's step count. However, my app is still unable to notify the user whether the goal has been achieved for the week. That means, the user will have to check manually to see whether they have completed their long-term goals, which can be quite a hassle.&lt;/p&gt;

&lt;p&gt;I stumbled across the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/subscription-0000001078496860?ha_source=hms3" rel="noopener noreferrer"&gt;scenario-based event subscription capability&lt;/a&gt; provided by HMS Core Health Kit, and tried integrating it into my app. Instead of subscribing to a single data type, I can now subscribe to specific scenarios, which entail the combination of one or more data types. In the example mentioned above, the scenario will be walking for 10,000 steps for any of the three days of a week. At the end of a week, my app will push a notification to the user, telling them whether they have met their goal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r7i5wia13lgtohcw8o5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r7i5wia13lgtohcw8o5.jpg" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After integrating the kit's scenario-based event subscription capability, my users have found it more convenient to track their long-term health and fitness goals. As a result, the user experience is considerably improved, and the retention period has been extended. My app is now a truly smart and handy fitness and health assistant. Next I'll show you how I managed to do this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Method
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Registering as a Subscriber
&lt;/h3&gt;

&lt;p&gt;Apply for the Health Kit service on HUAWEI Developers, select a product you have created, and select &lt;strong&gt;Registering the Subscription Notification Capability&lt;/strong&gt;. You can select the HTTP subscription mode, enter the callback notification address, and test the connectivity of the address. Currently, the subscription capability is available to enterprise developers only. If you are an individual developer, you will not be able to use this capability for your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6s7h8m4op0mf49fuwfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6s7h8m4op0mf49fuwfv.png" alt="Image description" width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also select device-side notification and set the app package name and action if your app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Uses the device-side subscription mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subscribes to scenario-based goal events.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Relies on communications between APKs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Registering Subscription Records
&lt;/h3&gt;

&lt;p&gt;Send an HTTP request as follows to add or update subscription records:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://health-api.cloud.huawei.com/healthkit/v1/subscriptions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Request example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://health-api.cloud.huawei.com/healthkit/v1/subscriptions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Request body
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://health-api.cloud.huawei.com/healthkit/v1/subscriptions
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
  "subscriberId": "08666998-78f6-46b9-8620-faa06cdbac2b",
  "eventTypes": [
        {
            "type": "SCENARIO_GOAL_EVENT",
            "subType": "ACHIEVE",
            "eventType": "SCENARIO_GOAL_EVENT$ACHIEVE",
            "goalInfo": {
                "createTime": 1654660859105,
                "startDay": 20220608,  // Set the goal start date, which must be later than the date on which the goal is created.
                "recurrence": {
                    "unit": 1,  // Set the period unit to day.
                    "count": 30, // Set the entire period to 30 days.
                    "expectedAchievedCount": 28
                },
                "goals": [
                    {
                        "goalType": 1,
                        "metricGoal": {
                            "value": 10000, // Set the goal to 10,000 steps.
                            "fieldName": "steps",
                            "dataType": "com.huawei.continuous.steps.total"
                        }
                    }
                ]
            }
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Receiving Notifications of Goal Achievement
&lt;/h3&gt;

&lt;p&gt;Send an HTTP request as follows to receive notifications of whether a goal is achieved:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://www.example.com/healthkit/notifications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Request example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://www.example.com/healthkit/notifications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Request body
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST
https://lfhealthdev.hwcloudtest.cn/test/healthkit/notifications
Content-Type: application/json
x-notification-signature: ***
[{
 "appId": "101524371",
 "subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
 "periodIndex": 0,
 "periodStartDay": 20220608,
 "periodEndDay": 20220608,
 "goalAchieve": [{
  "goalType": 1,
  "metricGoal": {
   "value": 10000.0,
   "fieldName": "steps",
   "dataType": "com.huawei.continuous.steps.total"
  },
"achievedFlag": true // Goal achieved.
 }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  (Optional) Querying Goal Achievement Results
&lt;/h3&gt;

&lt;p&gt;Send an HTTP request as follows to query results of scenario-based events in a single period:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET
https://health-api.cloud.huawei.com/healthkit/v1/subscriptions/3a82f885-97bf-47f8-84d1-21e558fe6e99/achievedRecord
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Request example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET
https://health-api.cloud.huawei.com/healthkit/v1/subscriptions/3a82f885-97bf-47f8-84d1-21e558fe6e99/achievedRecord
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Response body
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
[    
    {
 "openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY",
 "appId": "101524371",
 "subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
 "periodIndex": 0,
 "periodStartDay": 20220608,
 "periodEndDay": 20220608,
 "goalAchieve": [{
  "goalType": 1,
  "metricGoal": {
"value": 10000.0, // Goal value
   "fieldName": "steps",
   "dataType": "com.huawei.continuous.steps.total"
  },
"achievedResult": "20023", // Actual value
"achievedFlag": true // Flag indicating goal achieved
 }]
    },
    {
 "openId": "MDFAMTAxNTI0MzcxQGQ0Y2M3N2UxZTVmNjcxNWFkMWQ5Y2JjYjlmZDZiaNTY3QDVhNmNkY2FiaMTFhYzc4NDk4NDI0MzJiaNjg0MzViaYmUyMGEzZjZkNzUzYWVjM2Q5ZTgwYWM5NTgzNmY",
 "appId": "101524371",
 "subscriptionId": "3a82f885-97bf-47f8-84d1-21e558fe6e99",
 "periodIndex": 1,
 "periodStartDay": 20220609,
 "periodEndDay": 20220609,
 "goalAchieve": [{
  "goalType": 1,
  "metricGoal": {
   "value": 10000.0,  // Goal value
   "fieldName": "steps",
   "dataType": "com.huawei.continuous.steps.total"
  },
  "achievedResult": "9800",  // Actual value
  "achievedFlag": false // Flag indicating goal not achieved
 }]
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;It is common to find apps that notify users of real-time fitness and health events, for example, for every kilometer that's run, or when the user's heart rate crosses a certain threshold, or when they have walked certain number of steps that current day.&lt;/p&gt;

&lt;p&gt;However, health and fitness goals tend to be long-term, and can be broken down into small, periodic goals. This means that apps that only offer real time notifications are not as appealing as might otherwise be.&lt;/p&gt;

&lt;p&gt;Users may set a long-term goal, like losing 10 kg in three months, or going to the gym and exercising three times per week for the upcoming year, and then break down the goal into one month or one week increments. They may expect apps to function as a reminder of their fitness or health goals over the long run.&lt;/p&gt;

&lt;p&gt;Health Kit can help us do this easily, without requiring too much development workload.&lt;/p&gt;

&lt;p&gt;This kit provides the scenario-based event subscription capability, empowering health and fitness apps to periodically notify users of whether or not they have met their set goals, in a timely manner.&lt;/p&gt;

&lt;p&gt;With these notifications, app users will be able to keep better track of their goals, and be better motivated to meet them, or even use the app to share their goals with friends and loved ones.&lt;/p&gt;

</description>
      <category>java</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Can an App Show More POI Details to Users</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Tue, 09 Aug 2022 03:41:07 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-can-an-app-show-more-poi-details-to-users-5i4</link>
      <guid>https://dev.to/hmosdevelopers/how-can-an-app-show-more-poi-details-to-users-5i4</guid>
      <description>&lt;p&gt;With the increasing popularity of the mobile Internet, mobile apps are now becoming an integral part of our daily lives and provide increasingly more diverse functions that bring many benefits to users. One such function is searching for Point of Interests (POIs) or places, such as banks and restaurants, in an app.&lt;/p&gt;

&lt;p&gt;When a user searches for a POI in an app, besides general information about the POI, such as the name and location, they also expect to be shown other relevant details. For example, when searching for a POI in a taxi-hailing app, a user usually expects the app to display both the searched POI and other nearby POIs, so that the user can select the most convenient pick-up and drop-off point. When searching for a bank branch in a mobile banking app, a user usually wants the app to show both the searched bank branch and nearby POIs of a similar type and their details such as business hours, telephone numbers, and nearby roads.&lt;/p&gt;

&lt;p&gt;However, showing POI details in an app is usually a challenge for developers of non-map-related apps, because it requires a large amount of detailed POI data that is generally hard to collect for most app developers. So, wouldn't it be great if there was a service which an app can use to provide users with information about POI (such as the business hours and ratings) when they search for different types of POIs (such as hotels, restaurants, and scenic spots) in the app?&lt;/p&gt;

&lt;p&gt;Fortunately, HMS Core &lt;a href="https://developer.huawei.com/consumer/en/hms/huawei-sitekit/?ha_source=hms3" rel="noopener noreferrer"&gt;Site Kit&lt;/a&gt; provides a one-stop POI search service, which boasts more than 260 million POIs in over 200 countries and regions around the world. In addition, the service supports more than 70 languages, empowering users to search for places in their own native languages. The place detail search function in the kit allows an app to obtain information about a POI, such as the name, address, and longitude and latitude, based on the unique ID of the POI. For example, a user can search for nearby bank branches in a mobile banking app, and view information about each branch, such as their business hours and telephone numbers, or search for the location of a scenic spot and view information about nearby hotels and weather forecasts in a travel app, thanks to the place detail search function. The &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-place-details-0000001050156636?ha_source=hms3" rel="noopener noreferrer"&gt;place detail search&lt;/a&gt; function can even be utilized by location-based games that can use the function to show in-game tasks and rankings of other players at a POI when a player searches for the POI in the game.&lt;/p&gt;

&lt;p&gt;The integration process for this kit is straightforward, which I'll demonstrate below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4kkbaqg6umotf0mskid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4kkbaqg6umotf0mskid.png" alt="Image description" width="603" height="1056"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The screenshot below can give you an impression on the place detail search function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxw7qlw70b9cxvg76hy1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxw7qlw70b9cxvg76hy1.png" alt="Image description" width="455" height="973"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Procedure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1 Preparations
&lt;/h3&gt;

&lt;p&gt;Before getting started, you'll need to make some preparations, such as configuring your app information in AppGallery Connect, integrating the Site SDK, and configuring the obfuscation configuration file.&lt;/p&gt;

&lt;p&gt;If you use Android Studio, you can integrate the SDK into your project via the Maven repository. The purpose of configuring the obfuscation configuration file is to prevent the SDK from being obfuscated.&lt;/p&gt;

&lt;p&gt;You can follow instructions &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-config-agc-0000001050158579?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt; to make relevant preparations. In this article, I won't be describing the preparation steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  2 Developing Place Detail Search
&lt;/h3&gt;

&lt;p&gt;After making relevant preparations, you will need to implement the place detail search function for obtaining POI details. The process is as follows:&lt;/p&gt;

&lt;p&gt;i. Declare a &lt;strong&gt;SearchService&lt;/strong&gt; object and use &lt;strong&gt;SearchServiceFactory&lt;/strong&gt; to instantiate the object.&lt;/p&gt;

&lt;p&gt;When creating a &lt;strong&gt;SearchService&lt;/strong&gt; object, you need to pass the &lt;strong&gt;Context&lt;/strong&gt; parameter and API key. If you want to display an update wizard when HMS Core (APK) needs to be updated, you are advised to pass the &lt;strong&gt;Context&lt;/strong&gt; parameter of the &lt;strong&gt;Activity&lt;/strong&gt; type. As for the API key, it is generated when you create an app on the HUAWEI Developers website. Note that you need encode the API key using the &lt;strong&gt;URLEncoder.encode("&lt;/strong&gt;&lt;em&gt;Your apiKey&lt;/em&gt;&lt;strong&gt;", "UTF-8")&lt;/strong&gt; method.&lt;/p&gt;

&lt;p&gt;ii. Create a &lt;strong&gt;DetailSearchRequest&lt;/strong&gt; object and set relevant parameters.&lt;/p&gt;

&lt;p&gt;The object will be used as the request body for searching for POI details. Relevant parameters are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;siteId&lt;/strong&gt;: ID of a POI. This parameter is mandatory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;language&lt;/strong&gt;: language in which search results are displayed. English will be used if no language is specified, and if English is unavailable, the local language will be used.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;children&lt;/strong&gt;: indicates whether to return information about child nodes of the POI. The default value is &lt;strong&gt;false&lt;/strong&gt;, indicating that child node information is not returned. If this parameter is set to &lt;strong&gt;true&lt;/strong&gt;, all information about child nodes of the POI will be returned.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;iii. Create a &lt;strong&gt;SearchResultListener&lt;/strong&gt; object to listen for the search result.&lt;/p&gt;

&lt;p&gt;iv. Use the created &lt;strong&gt;SearchService&lt;/strong&gt; object to call the &lt;strong&gt;detailSearch()&lt;/strong&gt; method and pass the created &lt;strong&gt;DetailSearchRequest&lt;/strong&gt; and &lt;strong&gt;SearchResultListener&lt;/strong&gt; objects to the method.&lt;/p&gt;

&lt;p&gt;v. Obtain the &lt;strong&gt;DetailSearchResponse&lt;/strong&gt; object using the created &lt;strong&gt;SearchResultListener&lt;/strong&gt; object. You can obtain a &lt;strong&gt;Site&lt;/strong&gt; object from the &lt;strong&gt;DetailSearchResponse&lt;/strong&gt; object and then parse it to obtain the search results.&lt;/p&gt;

&lt;p&gt;The sample code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Declare a SearchService object.
private SearchService searchService; 
// Create a SearchService instance. 
searchService = SearchServiceFactory.create(this, "
API key
");
// Create a request body.
DetailSearchRequest request = new DetailSearchRequest(); 
request.setSiteId("
C2B922CC4651907A1C463127836D3957
"); 
request.setLanguage("
fr
"); 
request.setChildren(
false
);
// Create a search result listener.
SearchResultListener&amp;lt;DetailSearchResponse&amp;gt; resultListener = new SearchResultListener&amp;lt;DetailSearchResponse&amp;gt;() { 
    // Return the search result when the search is successful.
    @Override 
    public void onSearchResult(DetailSearchResponse result) { 
        Site site;
        if (result == null || (site = result.getSite()) == null) { 
            return; 
        }
         Log.i("TAG", String.format("siteId: '%s', name: %s\r\n", site.getSiteId(), site.getName())); 
    } 
    // Return the result code and description when a search exception occurs.
    @Override 
    public void onSearchError(SearchStatus status) { 
        Log.i("TAG", "Error : " + status.getErrorCode() + " " + status.getErrorMessage()); 
    } 
}; 
// Call the place detail search API.
searchService.detailSearch(request, resultListener);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have now completed the integration process and your app should be able to show users details about the POIs they search for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Mobile apps are now an integral part of our daily life. To improve user experience and provide users with a more convenient experience, mobile apps are providing more and more functions such as POI search.&lt;/p&gt;

&lt;p&gt;When searching for POIs in an app, besides general information such as the name and location of the POI, users usually expect to be shown other context-relevant information as well, such as business hours and similar POIs nearby. However, showing POI details in an app can be challenging for developers of non-map-related apps, because it requires a large amount of detailed POI data that is usually hard to collect for most app developers.&lt;/p&gt;

&lt;p&gt;In this article, I demonstrated how I solved this challenge using the place detail search function, which allows my app to show POI details to users. The whole integration process is straightforward and cost-efficient, and is an effective way to show POI details to users.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>poi</category>
    </item>
    <item>
      <title>How to Request Ads Using Location Data</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Tue, 09 Aug 2022 03:38:11 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-to-request-ads-using-location-data-4ee0</link>
      <guid>https://dev.to/hmosdevelopers/how-to-request-ads-using-location-data-4ee0</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Have you ever had the following experience: When you are walking on a road and searching for car information in a social networking app, an ad pops up to you suddenly, telling you about discounts at a nearby car dealership. Given the advantages of the short distance, demand matching, and discount, you are more likely to go to the place for some car details, and this ad succeeds to attract you to the activity.&lt;/p&gt;

&lt;p&gt;Nowadays, advertising has been one of the most effective ways for app developers to monetize traffic and achieve business success. By adding sponsored links or displaying ads in various formats, such as splash ads and banner ads, in their apps, app developers will be able to attract targeting audiences to view and tap the ads, or even purchase items. So how do apps always push ads for the right users at the right moment? Audience targeting methods may be the right thing they are looking for.&lt;/p&gt;

&lt;p&gt;In the car selling situation, you may wonder how the ad can know what you want.&lt;/p&gt;

&lt;p&gt;This benefits from the location-based ad requesting technology. Thanks to the increasing sophistication of ad technology, apps are now able to request user location-based ads, when being authorized, and audience targeting also makes it possible.&lt;/p&gt;

&lt;p&gt;So the most important thing for an ad is to reach its target customers. Therefore, app marketing personnel should be giving a lot of thought to how to target audience, place ads online to advertise their items, and maximize ad performance.&lt;/p&gt;

&lt;p&gt;That's why it is critical for apps to track audience information. Mobile location data can indicate the user's patterns of consumption. Office workers tend to order a lot of takeout on busy weekdays, trendsetters may prefer more stylish and fashion activities, and homeowners in high-end villas are more likely to purchase luxury items, to cite just some examples. All these mean that user attributes can be extracted from location information for ad matching purposes, and ad targeting should be as precise and multi-faceted as possible.&lt;/p&gt;

&lt;p&gt;As an app developer, I am always looking for new tools to help me match and request ads with greater precision. Some of these tools have disappointed me greatly. Fortunately, I stumbled upon Ads Kit in HMS Core, which is capable of &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/publisher-service-location-based-0000001163023235?ha_source=hms3" rel="noopener noreferrer"&gt;requesting ads based on geographical locations&lt;/a&gt;. With this tool, I've been able to integrate ads in various formats into my app with greater ease, and provide targeted, audience specific marketing content, including native and roll ads for nearby restaurants, stores, courses, and more.&lt;/p&gt;

&lt;p&gt;I've been able to achieve monetization success with improvement of user conversions and substantially boost my ad revenue as a result.&lt;/p&gt;

&lt;p&gt;To display ads more efficiently and accurately, my app can carry users’ location information through the Ads SDK, when requesting ads, so long as my app has been authorized to obtain the users' location information.&lt;/p&gt;

&lt;p&gt;The SDK is surprisingly easy to integrate. Here's how to do it:&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Steps
&lt;/h2&gt;

&lt;p&gt;First, request permissions for your app.&lt;/p&gt;

&lt;p&gt;i. As the Android OS provides two location permissions: &lt;strong&gt;ACCESS_COARSE_LOCATION&lt;/strong&gt; (approximate location permission) and &lt;strong&gt;ACCESS_FINE_LOCATION&lt;/strong&gt; (precise location permission), configure the permissions in the &lt;strong&gt;AndroidManifest.xml&lt;/strong&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&amp;gt;
&amp;lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. (Optional) If your app needs to continuously locate the device of Android 10 or later when it runs in the background, configure the &lt;strong&gt;ACCESS_BACKGROUND_LOCATION&lt;/strong&gt; permission in the &lt;strong&gt;AndroidManifest.xml&lt;/strong&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iii. Dynamically apply for related location permissions (according to requirements for dangerous permissions in Android 6.0 or later).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Dynamically apply for required permissions if the API level is 28 or lower.
if (Build.VERSION.SDK_INT &amp;lt;= Build.VERSION_CODES.P) {
    Log.i(TAG, "android sdk &amp;lt;= 28 Q");
    if (ActivityCompat.checkSelfPermission(this,
        Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
        &amp;amp;&amp;amp; ActivityCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        String[] strings =
            {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
        ActivityCompat.requestPermissions(this, strings, 1);
    }
} else {
    // Dynamically apply for required permissions if the API level is greater than 28. The android.permission.ACCESS_BACKGROUND_LOCATION permission is required.
    if (ActivityCompat.checkSelfPermission(this,
        Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
        &amp;amp;&amp;amp; ActivityCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
        &amp;amp;&amp;amp; ActivityCompat.checkSelfPermission(this,
            "android.permission.ACCESS_BACKGROUND_LOCATION") != PackageManager.PERMISSION_GRANTED) {
        String[] strings = {android.Manifest.permission.ACCESS_FINE_LOCATION,
            android.Manifest.permission.ACCESS_COARSE_LOCATION,
            "android.permission.ACCESS_BACKGROUND_LOCATION"};
        ActivityCompat.requestPermissions(this, strings, 2);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your app requests and obtains the location permission from a user, the SDK will carry the location information by default. If you do not want to carry the location information in an ad request from the app, you can call the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/requestoptions-builder-0000001050064896#section8952113613360?ha_source=hms3" rel="noopener noreferrer"&gt;setRequestLocation()&lt;/a&gt; API and set &lt;strong&gt;requestLocation&lt;/strong&gt; to &lt;strong&gt;false&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Here, a banner ad is used as an example. The location information is not carried.
AdParam adParam = new AdParam.Builder()
        // Indicates whether location information is carried in a request. The options are true (yes) and false (no). The default value is true.
        .setRequestLocation(false)
        .build();
bannerView.loadAd(adParam);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;All app developers are deeply concerned with how to boost conversions and revenue, by targeting ad audiences. The key is gaining insight into what users care most about. Real time location is a key piece of this puzzle.&lt;/p&gt;

&lt;p&gt;If your apps are permitted to do so, you can add personalized ads in apps for these users. Displaying ads through ad networks may be the most popular way to help you monetize traffic and other content. A good advertising mechanism can help you a lot, and in this way, location-based ad requesting is very important in this process. Through users' locations, you will be able to give what they are looking for and show ads perfectly matching user intent. All these implementations may be a complicated process, and I have been also searching for good ways for better results.&lt;/p&gt;

&lt;p&gt;As you can see from the coding above, this SDK is easy to implement, with just a few lines of code, and is highly useful for you to request location-based ads. I hope that it serves you as well as it has served me.&lt;/p&gt;

</description>
      <category>java</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>hmscore</category>
    </item>
    <item>
      <title>How to Develop a Timelapse Effect Generator</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Tue, 09 Aug 2022 01:15:42 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-to-develop-a-timelapse-effect-generator-43h</link>
      <guid>https://dev.to/hmosdevelopers/how-to-develop-a-timelapse-effect-generator-43h</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Have you ever watched a video of the northern lights? Mesmerizing light rays that swirl and dance through the star-encrusted sky. It's even more stunning when they are backdropped by crystal-clear waters that flow smoothly between and under ice crusts. Complementing each other, the moving sky and water compose a dynamic scene that reflects the constant rhythm of the mother nature.&lt;/p&gt;

&lt;p&gt;Now imagine that the video is frozen into an image: It still looks beautiful, but lacks the dynamism of the video. Such a contrast between still and moving images shows how videos are sometimes better than still images when it comes to capturing majestic scenery, since the former can convey more information and thus be more engaging.&lt;/p&gt;

&lt;p&gt;This may be the reason why we sometimes regret just taking photos instead of capturing a video when we encounter beautiful scenery or a memorable moment.&lt;/p&gt;

&lt;p&gt;In addition to this, when we try to add a static image to a short video, we will find that the transition between the image and other segments of the video appears very awkward, since the image is the only static segment in the whole video.&lt;/p&gt;

&lt;p&gt;If we want to turn a static image into a dynamic video by adding some motion effects to the sky and water, one way to do this is to use a professional PC program to modify the image. However, this process is often very complicated and time-consuming: It requires adjustment of the timeline, frames, and much more, which can be a daunting prospect for amateur image editors.&lt;/p&gt;

&lt;p&gt;Luckily, there are now numerous AI-driven capabilities that can automatically create time-lapse videos for users. I chose to use the auto-timelapse capability provided by &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Media-Guides/ai_algorithm_integration-0000001166552824#section184201142102914?ha_source=hms3" rel="noopener noreferrer"&gt;HMS Core Video Editor Kit&lt;/a&gt;. It can automatically detect the sky and water in an image and produce vivid dynamic effects for them, just like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3omjm9deroum9dxyh29e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3omjm9deroum9dxyh29e.gif" alt="Image description" width="602" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The movement speed and angle of the sky and water are customizable.&lt;/p&gt;

&lt;p&gt;Now let's take a look at the detailed integration procedure for this capability, to better understand how such a dynamic effect is created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Procedure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Preparations
&lt;/h3&gt;

&lt;p&gt;i. Configure necessary app information. This step requires you to register a developer account, create an app, generate a signing certificate fingerprint, configure the fingerprint, and enable the required services.&lt;br&gt;
ii. Integrate the SDK of the kit.&lt;br&gt;
iii. Configure the obfuscation scripts.&lt;br&gt;
iv. Declare necessary permissions.&lt;/p&gt;
&lt;h3&gt;
  
  
  Project Configuration
&lt;/h3&gt;

&lt;p&gt;i. Set the app authentication information. This can be done via an API key or an access token.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set an API key via the &lt;strong&gt;setApiKey&lt;/strong&gt; method: You only need to set the app authentication information once during app initialization.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setApiKey("your ApiKey");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Or, set an access token by using the &lt;strong&gt;setAccessToken&lt;/strong&gt; method: You only need to set the app authentication information once during app initialization.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setAccessToken("your access token");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;ii. Set a License ID. This ID should be unique because it is used to manage the usage quotas of the service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setLicenseId("License ID");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iii. Initialize the runtime environment for the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Media-References/huaweivideoeditor-0000001157249152?ha_source=hms3" rel="noopener noreferrer"&gt;HuaweiVideoEditor&lt;/a&gt; object. Remember to release the &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object when exiting the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Specify the preview area position. Such an area is used to render video images, which is implemented by &lt;strong&gt;SurfaceView&lt;/strong&gt; created within the SDK. Before creating such an area, specify its position in the app first.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;LinearLayout    
    android:id="@+id/video_content_layout"    
    android:layout_width="0dp"    
    android:layout_height="0dp"    
    android:background="@color/video_edit_main_bg_color"    
    android:gravity="center"    
    android:orientation="vertical" /&amp;gt;
// Specify the preview area position.
LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);

// Specify the preview area layout.
editor.setDisplay(mSdkPreviewContainer);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the runtime environment. If license verification fails, &lt;strong&gt;LicenseException&lt;/strong&gt; will be thrown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After it is created, the &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object will not occupy any system resources. You need to manually set when the runtime environment of the object will be initialized. Once you have done this, necessary threads and timers will be created within the SDK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
        editor.initEnvironment();
   } catch (LicenseException error) { 
        SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());    
        finish();
        return;
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Function Development
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Initialize the auto-timelapse engine.
imageAsset.initTimeLapseEngine(new HVEAIInitialCallback() {
        @Override
        public void onProgress(int progress) {
            // Callback when the initialization progress is received.
        }

        @Override
        public void onSuccess() {
            // Callback when the initialization is successful.
        }

        @Override
        public void onError(int errorCode, String errorMessage) {
            // Callback when the initialization failed.
        }
});
// When the initialization is successful, check whether there is sky or water in the image.
int motionType = -1;
imageAsset.detectTimeLapse(new HVETimeLapseDetectCallback() {
        @Override
        public void onResult(int state) {
            // Record the state parameter, which is used to define a motion effect.
            motionType = state;
        }
});

// skySpeed indicates the speed at which the sky moves; skyAngle indicates the direction to which the sky moves; waterSpeed indicates the speed at which the water moves; waterAngle indicates the direction to which the water moves.
HVETimeLapseEffectOptions options = 
new HVETimeLapseEffectOptions.Builder().setMotionType(motionType)
        .setSkySpeed(skySpeed)
        .setSkyAngle(skyAngle)
        .setWaterAngle(waterAngle)
        .setWaterSpeed(waterSpeed)
        .build();

// Add the auto-timelapse effect.
imageAsset.addTimeLapseEffect(options, new HVEAIProcessCallback() {
        @Override
        public void onProgress(int progress) {
        }
        @Override
        public void onSuccess() {
        }
        @Override
        public void onError(int errorCode, String errorMessage) {
        }
});
// Stop applying the auto-timelapse effect.
imageAsset.interruptTimeLapse();

// Remove the auto-timelapse effect.
imageAsset.removeTimeLapseEffect();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the auto-timelapse capability has been successfully integrated into an app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;When capturing scenic vistas, videos, which can show the dynamic nature of the world around us, are often a better choice than static images. In addition, when creating videos with multiple shots, dynamic pictures deliver a smoother transition effect than static ones.&lt;/p&gt;

&lt;p&gt;However, for users not familiar with the process of animating static images, if they try do so manually using computer software, they may find the results unsatisfying.&lt;/p&gt;

&lt;p&gt;The good news is that there are now mobile apps integrated with capabilities such as Video Editor Kit's auto-timelapse feature that can create time-lapse effects for users. The generated effect appears authentic and natural, the capability is easy to use, and its integration is straightforward. With such capabilities in place, a video/image app can provide users with a more captivating user experience.&lt;/p&gt;

&lt;p&gt;In addition to video/image editing apps, I believe the auto-timelapse capability can also be utilized by many other types of apps. What other kinds of apps do you think would benefit from such a feature? Let me know in the comments section.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How I Developed a Smile Filter for My App</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Tue, 09 Aug 2022 01:12:53 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-i-developed-a-smile-filter-for-my-app-4n81</link>
      <guid>https://dev.to/hmosdevelopers/how-i-developed-a-smile-filter-for-my-app-4n81</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I recently read an article that explained how we as human beings are hardwired to enter the fight-or-flight mode when we realize that we are being watched. This feeling is especially strong when somebody else is trying to take a picture of us, which is why many of us find it difficult to smile in photos. This effect is so strong that we've all had the experience of looking at a photo right after it was taken and noticing straight away that the photo needs to be retaken because our smile wasn't wide enough or didn't look natural. So, the next time someone criticizes my smile in a photo, I'm just going to them, "It's not my fault. It's literally an evolutionary trait!"&lt;/p&gt;

&lt;p&gt;Or, instead of making such an excuse, what about turning to technology for help? Actually, I have tried using some photo editor apps to modify my portrait photos, making my facial expression look nicer by, for example, removing my braces, whitening my teeth, and erasing my smile lines. However, maybe it's because of my rusty image editing skills, the modified images often turn out to be strange.&lt;/p&gt;

&lt;p&gt;My lack of success with photo editing made me wonder: Wouldn't it be great if there was a function specially designed for people like me, who find it difficult to smile naturally in photos and who aren't good at photo editing, which could automatically give us picture-perfect smiles?&lt;/p&gt;

&lt;p&gt;I then suddenly remembered that I had heard about an interesting function called smile filter that has been going viral on different apps and platforms. A smile filter is an app feature which can automatically add a natural-looking smile to a face detected in an image. I have tried it before and was really amazed by the result. In light of my sudden recall, I decided to create a demo app with a similar function, in order to figure out the principle behind it.&lt;/p&gt;

&lt;p&gt;To provide my app with a smile filter, I chose to use the auto-smile capability provided by &lt;a href="https://developer.huawei.com/consumer/en/hms/huawei-video-editor?ha_source=hms3" rel="noopener noreferrer"&gt;HMS Core Video Editor Kit&lt;/a&gt;. This capability automatically detects people in an image and then lightens up the detected faces with a smile (either closed- or open-mouth) that perfectly blends in with each person's facial structure. With the help of such a capability, a mobile app can create the perfect smile in seconds and save users from the hassle of having to use a professional image editing program.&lt;/p&gt;

&lt;p&gt;Check the result out for yourselves:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0hrr88ewca1oxqnbxd1k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0hrr88ewca1oxqnbxd1k.jpg" alt="Image description" width="629" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looks pretty natural, right? This is the result offered by my demo app integrated with the auto-smile capability. The original image looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z059c3cstnqnhsdiymq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z059c3cstnqnhsdiymq.jpg" alt="Image description" width="622" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, I will explain how I integrated the auto-smile capability into my app and share the relevant source code from my demo app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Procedure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Preparations
&lt;/h3&gt;

&lt;p&gt;i. Configure necessary app information. This step requires you to register a developer account, create an app, generate a signing certificate fingerprint, configure the fingerprint, and enable required services.&lt;/p&gt;

&lt;p&gt;ii. Integrate the SDK of the kit.&lt;/p&gt;

&lt;p&gt;iii. Configure the obfuscation scripts.&lt;/p&gt;

&lt;p&gt;iv. Declare necessary permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Configuration
&lt;/h3&gt;

&lt;p&gt;i. Set the app authentication information. This can be done via an API key or an access token.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using an API key: You only need to set the app authentication information once during app initialization.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setApiKey("your ApiKey");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Or, using an access token: You only need to set the app authentication information once during app initialization.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setAccessToken("your access token");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. Set a License ID, which must be unique because it is used to manage the usage quotas of the service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MediaApplication.getInstance().setLicenseId("License ID");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iii. Initialize the runtime environment for the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Media-References/huaweivideoeditor-0000001157249152?ha_source=hms3" rel="noopener noreferrer"&gt;HuaweiVideoEditor&lt;/a&gt; object. Remember to release the &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object when exiting the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HuaweiVideoEditor editor = HuaweiVideoEditor.create(getApplicationContext());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Specify the preview area position. Such an area is used to render video images, which is implemented by &lt;strong&gt;SurfaceView&lt;/strong&gt; created within the SDK. Before creating such an area, specify its position in the app first.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;LinearLayout    
    android:id="@+id/video_content_layout"    
    android:layout_width="0dp"    
    android:layout_height="0dp"    
    android:background="@color/video_edit_main_bg_color"    
    android:gravity="center"    
    android:orientation="vertical" /&amp;gt;
// Specify the preview area position.
LinearLayout mSdkPreviewContainer = view.findViewById(R.id.video_content_layout);

// Specify the preview area layout.
editor.setDisplay(mSdkPreviewContainer);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the runtime environment. If license verification fails, &lt;strong&gt;LicenseException&lt;/strong&gt; will be thrown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After it is created, the &lt;strong&gt;HuaweiVideoEditor&lt;/strong&gt; object will not occupy any system resources. You need to manually set when the runtime environment of the object will be initialized. Once you have done this, necessary threads and timers will be created within the SDK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
        editor.initEnvironment();
   } catch (LicenseException error) { 
        SmartLog.e(TAG, "initEnvironment failed: " + error.getErrorMsg());    
        finish();
        return;
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Function Development
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Apply the auto-smile effect. Currently, this effect only supports image assets.
imageAsset.addFaceSmileAIEffect(new HVEAIProcessCallback() {
        @Override
        public void onProgress(int progress) {
            // Callback when the handling progress is received.
        }
        @Override
        public void onSuccess() {
            // Callback when the handling is successful.
        }
        @Override
        public void onError(int errorCode, String errorMessage) {
            // Callback when the handling failed.
        }
});
// Stop applying the auto-smile effect.
imageAsset.interruptFaceSmile();
// Remove the auto-smile effect.
imageAsset.removeFaceSmileAIEffect();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with that, I successfully integrated the auto-smile capability into my demo app, and now it can automatically add smiles to faces detected in the input image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Research has demonstrated that it is normal for people to behave unnaturally when we are being photographed. Such unnaturalness becomes even more obvious when we try to smile. This explains why numerous social media apps and video/image editing apps have introduced smile filter functions, which allow users to easily and quickly add a naturally looking smile to faces in an image.&lt;/p&gt;

&lt;p&gt;Among various solutions to such a function, HMS Core Video Editor Kit's auto-smile capability stands out by providing excellent, natural-looking results and featuring straightforward and quick integration.&lt;/p&gt;

&lt;p&gt;What's better, the auto-smile capability can be used together with other capabilities from the same kit, to further enhance users' image editing experience. For example, when used in conjunction with the kit's AI color capability, you can add color to an old black-and-white photo and then use auto-smile to add smiles to the sullen expressions of the people in the photo. It's a great way to freshen up old and dreary photos from the past.&lt;/p&gt;

&lt;p&gt;And that's just one way of using the auto-smile capability in conjunction with other capabilities. What ideas do you have? Looking forward to knowing your thoughts in the comments section.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Get Traffic Data for Better Ad Performance</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Thu, 28 Jul 2022 09:10:21 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-to-get-traffic-data-for-better-ad-performance-1m5c</link>
      <guid>https://dev.to/hmosdevelopers/how-to-get-traffic-data-for-better-ad-performance-1m5c</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Ads are everywhere and we can't escape them. They're on road billboards, shops, buses and buildings. If a world filled with ads sounds daunting and you want to hide indoors, just beware that ads will even jump out at you from your TV, computer, or phone.&lt;/p&gt;

&lt;p&gt;It's likely that ads will be around with us for forever. Ads are often seen as annoying, but they can in fact be very helpful. If you are looking for a job, want to go somewhere fun, or are not sure what special thing you can get for your other half's birthday, ads may in fact provide some inspiration to you.&lt;/p&gt;

&lt;p&gt;Nowadays, ads are transforming in appearance and purpose. Ads are becoming more intuitive as they are able to target specific audiences. For example, ads about quick fashion will target young adults, while car ads are typically pushed to automobile enthusiasts. This is an advanced advertising mechanism for brands, media, and users, where all can benefit. Someone gets traffic, someone makes money, and someone gets what they needed. Under ideal conditions, ads, under control and without harmful information spread, mean a lot for us.&lt;/p&gt;

&lt;p&gt;As an app developer, I have been trying for a long time to request ads in my app to monetize the traffic and increase revenue. Recently, I encountered some obstacles with the ad traffic monetization data of my own app, and I have been searching for tools to obtain data and analyze ad performance. Collecting such data and then deciding how to analyze ad performance was no easy task, and this was complicated by the many tools and plugins needed to do so. I have used some of the tools found in the industry, but their performance rarely satisfied me.&lt;/p&gt;

&lt;p&gt;But I eventually came across a very useful tool, the Publisher Service Reporting API of Ads Kit provided by HMS Core. The traffic monetization service helps me display various ad formats, such as banners, native ads, and rewarded ads, to my users. Routine data tracking is crucial for me to boost revenue. What's more, the Reporting API is key to obtaining ad monetization data, including ad requests, returned ads, impression rate, and click-through rate. I can analyze ad performance based on this data and adjust my monetization strategies accordingly.&lt;/p&gt;

&lt;p&gt;But how did I acquire traffic monetization data? Here I'll tell you how I did it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation Procedure
&lt;/h2&gt;

&lt;p&gt;i. Obtain the client ID and key.&lt;/p&gt;

&lt;p&gt;Before obtaining the monetization data, prepare an OAuth 2.0 client ID and key, which are needed for generating the access token passed for calling the Reporting API.&lt;/p&gt;

&lt;p&gt;Note that the client ID and key are not those in &lt;strong&gt;App information&lt;/strong&gt; (shown in the following red box) in AppGallery Connect, instead, the client ID and key of the server app created under &lt;strong&gt;HMS API services&lt;/strong&gt; &amp;gt; &lt;strong&gt;Credentials&lt;/strong&gt; on HUAWEI Developers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs8ts9ov8kv0x1wlcgx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs8ts9ov8kv0x1wlcgx2.png" alt="Image description" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;a. &lt;a href="https://developer.huawei.com/consumer/en/?ha_source=hms3" rel="noopener noreferrer"&gt;Register as a developer&lt;/a&gt; and complete identity verification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh1k85yckkxdz7xqzsh5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh1k85yckkxdz7xqzsh5r.png" alt="Image description" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;b. Sign in to the console, choose &lt;strong&gt;HMS API Services&lt;/strong&gt; &amp;gt; &lt;strong&gt;Credentials&lt;/strong&gt;, and create a project. If you already have a project, directly select it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the drop-down arrow at the top, click &lt;strong&gt;New project&lt;/strong&gt;, fill in the project name and alias, and click &lt;strong&gt;OK&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4xb1871dx33tsw9utvb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4xb1871dx33tsw9utvb.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the project you created and click &lt;strong&gt;OK&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxiggm7v5ru016txdg680.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxiggm7v5ru016txdg680.png" alt="Image description" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;c. Choose &lt;strong&gt;OAuth 2.0 client ID&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eunvfjbotjal4mlgeh7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eunvfjbotjal4mlgeh7.png" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If an OAuth 2.0 client ID and key already exist in your project, you can check whether the product type is server app by clicking &lt;strong&gt;Edit&lt;/strong&gt; in the &lt;strong&gt;Operation&lt;/strong&gt; column of the project. If so, skip step d.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftga35qvwema0lxfrxnsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftga35qvwema0lxfrxnsn.png" alt="Image description" width="800" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your product is not a server app, you should create an OAuth 2.0 client ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1lozijsy710c4ln9gpee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1lozijsy710c4ln9gpee.png" alt="Image description" width="747" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;d. Select &lt;strong&gt;Server app&lt;/strong&gt; from &lt;strong&gt;Product type&lt;/strong&gt;, set &lt;strong&gt;Product name&lt;/strong&gt;, &lt;strong&gt;App type&lt;/strong&gt;, and &lt;strong&gt;Default language&lt;/strong&gt;, and click &lt;strong&gt;Create&lt;/strong&gt;. In the &lt;strong&gt;Note&lt;/strong&gt; dialog box that displays &lt;strong&gt;Client ID&lt;/strong&gt; and &lt;strong&gt;Key&lt;/strong&gt;, click &lt;strong&gt;Confirm&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312ivmqtr7khxg0qd332.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312ivmqtr7khxg0qd332.png" alt="Image description" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;e. Go to &lt;strong&gt;HMS API services&lt;/strong&gt; &amp;gt; &lt;strong&gt;My APIs&lt;/strong&gt;, ensure that the project is the one you created, and click &lt;strong&gt;Add API from library&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8w5u5cs9rq1pxfn0q1rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8w5u5cs9rq1pxfn0q1rw.png" alt="Image description" width="670" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;f. Click &lt;strong&gt;Publisher Service Reporting API&lt;/strong&gt; under &lt;strong&gt;App Services&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmitujp4vo2so7kp2qcfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmitujp4vo2so7kp2qcfb.png" alt="Image description" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;g. On the page displayed, click &lt;strong&gt;Enable&lt;/strong&gt; to enable the API. Then you can call the API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbo0in1h687iq8rrbkymv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbo0in1h687iq8rrbkymv.png" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you disable it and then enable it again, the setting does not take effect in real time due to page cache, for example. The setting will take about 6 to 10 minutes to take effect. If you have waited for longer time, try again.&lt;/p&gt;

&lt;p&gt;ii. Call the Publisher Service Reporting API.&lt;/p&gt;

&lt;p&gt;a. Obtain an access token.&lt;/p&gt;

&lt;p&gt;Call this API:&lt;/p&gt;

&lt;p&gt;POST &lt;a href="https://oauth-login.cloud.huawei.com/oauth2/v3/token" rel="noopener noreferrer"&gt;https://oauth-login.cloud.huawei.com/oauth2/v3/token&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Request example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /oauth2/v3/token HTTP/1.1
Host: oauth-login.cloud.huawei.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&amp;amp;
client_id=&amp;lt;Client ID&amp;gt;&amp;amp;
client_secret=&amp;lt;Client secret&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ve2n5pt6m0mmubjwjq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ve2n5pt6m0mmubjwjq4.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that again: the client ID and key are those of the server app but not those of the mobile app created.&lt;/p&gt;

&lt;p&gt;b. Call the Reporting API.&lt;/p&gt;

&lt;p&gt;POST &lt;a href="https://ads.cloud.huawei.com/openapi/monetization/reports/v1/publisher" rel="noopener noreferrer"&gt;https://ads.cloud.huawei.com/openapi/monetization/reports/v1/publisher&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are in Russia, call this API:&lt;/p&gt;

&lt;p&gt;POST &lt;a href="https://ads-drru.cloud.huawei.ru/openapi/monetization/reports/v1/publisher" rel="noopener noreferrer"&gt;https://ads-drru.cloud.huawei.ru/openapi/monetization/reports/v1/publisher&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Request example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /openapi/monetization/reports/v1/publisher HTTP/1.1
Content-Type: application/json
Authorization: Bearer ***
        Accept: application/json
Content-Length: 233

{
    "start_date": "2022-06-01",
    "end_date": "2022-06-28",
    "filtering": {
        "currency": "CNY"
    },
    "time_granularity": "STAT_TIME_GRANULARITY_DAILY",
    "page": 1,
    "page_size": 10
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fljiurio20rgynwr7jja0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fljiurio20rgynwr7jja0.png" alt="Image description" width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the preceding figure, the data is successfully returned. For more request parameters and response parameters, click &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/query-publisher-service-reports-0000001050933546#section20939514163519?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In addition, I can customize data display formats to suit my specific app scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some Problems You May Encounter
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why was message "access forbidden" returned during the API calling?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2ckn9q10fbuthy5fs80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2ckn9q10fbuthy5fs80.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Possible causes:
&lt;/h3&gt;

&lt;p&gt;1) You have not enabled the Reporting API.&lt;/p&gt;

&lt;p&gt;2) You have not been authorized to call this API, or your permission has not taken effect yet.&lt;/p&gt;

&lt;p&gt;3) The client ID and key used for obtaining the access token are not those of your server app.&lt;/p&gt;

&lt;h3&gt;
  
  
  My solutions:
&lt;/h3&gt;

&lt;p&gt;i. Click &lt;strong&gt;Add API from library&lt;/strong&gt; under &lt;strong&gt;My APIs&lt;/strong&gt; and enable the Reporting API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbfgrqag4zxbc4lrhwyp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbfgrqag4zxbc4lrhwyp.png" alt="Image description" width="320" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrrauha1ck9t076l4byg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrrauha1ck9t076l4byg.png" alt="Image description" width="383" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbapabeodvzya2yu6xfkt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbapabeodvzya2yu6xfkt.png" alt="Image description" width="519" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ii. If you disabled and enabled the API again, you may need to wait for 6-10 minutes before the setting takes effect.&lt;/p&gt;

&lt;p&gt;iii. Check whether your client ID and key belong to a server app when you obtain the access token. To find out it, check the app type on the &lt;strong&gt;Credentials&lt;/strong&gt; page. If it is not a server app, create one and use its client ID and key to request an access token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1oerqp2sbj3w876jqo48.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1oerqp2sbj3w876jqo48.png" alt="Image description" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg6w2n01m33giufeqqqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg6w2n01m33giufeqqqc.png" alt="Image description" width="800" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Daily advertising data tracking matters very much for app developers, and how to easily get these data is also very important. These data helps me learn about app operations effects in real time, and I can adjust my strategies accordingly. Choosing the right tool or method to do this will make us win more with less work. If you also think obtaining ad monetization data and dealing with ad issues are annoying as me, you can try this tool to help you in subsequent operations. Hope that my procedure and experience can benefit more guys and you can also find out more about useful methods.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>performance</category>
    </item>
    <item>
      <title>Turn Your App into a Handy Health Assistant</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Thu, 28 Jul 2022 09:03:00 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/turn-your-app-into-a-handy-health-assistant-3d23</link>
      <guid>https://dev.to/hmosdevelopers/turn-your-app-into-a-handy-health-assistant-3d23</guid>
      <description>&lt;p&gt;Personalized health records and visual tools have been a godsend for digital health management, giving users the tools to conveniently track their health on their mobile phones. From diet to weight and fitness and beyond, storing, managing, and sharing health data has never been easier. Users can track their health over a specific period of time, like a week or a month, to identify potential diseases in a timely manner, and to lead a healthy lifestyle. Moreover, with personalized health records in hand, trips to the doctor now lead to quicker and more accurate diagnoses. Health Kit takes this new paradigm into overdrive, opening up a wealth of capabilities that can endow your health app with nimble, user-friendly features.&lt;/p&gt;

&lt;p&gt;With the basic capabilities of Health Kit integrated, your app will be able to obtain users' health data on the cloud from the Huawei Health app, after obtaining users' authorization, and then display the data to users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Effects​
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp2o5n3rrk5tqc48nqtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp2o5n3rrk5tqc48nqtm.png" alt="Image description" width="430" height="718"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This demo is modified based on the &lt;a href="https://github.com/HMS-Core/hms-health-demo?ha_source=hms3" rel="noopener noreferrer"&gt;sample code of Health Kit's basic capabilities&lt;/a&gt;. You can download the demo and try it out to build your own health app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparations​
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Registering an Account and Applying for the HUAWEI ID Service​
&lt;/h3&gt;

&lt;p&gt;Health Kit uses the HUAWEI ID service and therefore, you need to apply for the HUAWEI ID service first. Skip this step if you have done so for your app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Applying for the Health Kit Service​
&lt;/h3&gt;

&lt;p&gt;Apply for the data read and write scopes for your app. Find the Health Kit service in the &lt;strong&gt;Development&lt;/strong&gt; section on HUAWEI Developers, and apply for the Health Kit service. Select the data scopes required by your app. In the demo, the height and weight data are applied for, which are unrestricted data and will be quickly approved after your application is submitted. If you want to apply for restricted data scopes such as heart rate, blood pressure, blood glucose, and blood oxygen saturation, your application will be manually reviewed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5pntdhfe14vjsuouc90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5pntdhfe14vjsuouc90.png" alt="Image description" width="622" height="618"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrating the HMS Core SDK​
&lt;/h3&gt;

&lt;p&gt;Before getting started, integrate the Health SDK of the basic capabilities into the development environment.&lt;/p&gt;

&lt;p&gt;Use Android Studio to open the project, and find and open the &lt;strong&gt;build.gradle&lt;/strong&gt; file in the root directory of the project. Go to &lt;strong&gt;allprojects&lt;/strong&gt; &amp;gt; &lt;strong&gt;repositories&lt;/strong&gt; and &lt;strong&gt;buildscript&lt;/strong&gt; &amp;gt; &lt;strong&gt;repositories&lt;/strong&gt; to add the Maven repository address for the SDK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;maven {url 'https://developer.huawei.com/repo/'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the app-level &lt;strong&gt;build.gradle&lt;/strong&gt; file and add the following build dependency to the &lt;strong&gt;dependencies&lt;/strong&gt; block.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;implementation 'com.huawei.hms:health:{version}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the modified &lt;strong&gt;build.gradle&lt;/strong&gt; file again. You will find a &lt;strong&gt;Sync Now&lt;/strong&gt; link in the upper right corner of the page. Click &lt;strong&gt;Sync Now&lt;/strong&gt; and wait until the synchronization is complete.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring the Obfuscation Configuration File​
&lt;/h3&gt;

&lt;p&gt;Before building the APK, configure the obfuscation configuration file to prevent the HMS Core SDK from being obfuscated.&lt;/p&gt;

&lt;p&gt;Open the obfuscation configuration file &lt;strong&gt;proguard-rules.pro&lt;/strong&gt; in the app's root directory of the project, and add configurations to exclude the HMS Core SDK from obfuscation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Importing the Certificate Fingerprint, Changing the Package Name, and Configuring the JDK Build Version​
&lt;/h3&gt;

&lt;p&gt;Import the keystore file generated when the app is created. After the import, open the app-level &lt;strong&gt;build.gradle&lt;/strong&gt; file to view the import result.&lt;/p&gt;

&lt;p&gt;代码图&lt;/p&gt;

&lt;p&gt;Change the app package name to the one you set in applying for the HUAWEI ID Service.&lt;/p&gt;

&lt;p&gt;Open the app-level &lt;strong&gt;build.gradle&lt;/strong&gt; file and add the &lt;strong&gt;compileOptions&lt;/strong&gt; configuration to the &lt;strong&gt;android&lt;/strong&gt; block as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Main Implementation Code
&lt;/h2&gt;

&lt;p&gt;i. Start the screen for login and authorization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * Add scopes that you are going to apply for and obtain the authorization intent.
 */
private void requestAuth() {
    // Add scopes that you are going to apply for. The following is only an example.
    // You need to add scopes for your app according to your service needs.
    String[] allScopes = Scopes.getAllScopes();
    // Obtain the authorization intent.
    // True indicates that the Huawei Health app authorization process is enabled; False otherwise.
    Intent intent = mSettingController.requestAuthorizationIntent(allScopes, true);

    // The authorization screen is displayed.
    startActivityForResult(intent, REQUEST_AUTH);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. Call &lt;strong&gt;com.huawei.hms.hihealth&lt;/strong&gt;. Then call &lt;strong&gt;readLatestData()&lt;/strong&gt; of the &lt;strong&gt;DataController&lt;/strong&gt; class to read the latest health-related data, including height, weight, heart rate, blood pressure, blood glucose, and blood oxygen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * Read the latest data according to the data type.
 *
 * @param view (indicating a UI object)
 */
public void readLatestData(View view) {
    // 1. Call the data controller using the specified data type (DT_INSTANTANEOUS_HEIGHT) to query data.
    // Query the latest data of this data type.
    List&amp;lt;DataType&amp;gt; dataTypes = new ArrayList&amp;lt;&amp;gt;();
    dataTypes.add(DataType.DT_INSTANTANEOUS_HEIGHT);
    dataTypes.add(DataType.DT_INSTANTANEOUS_BODY_WEIGHT);
    dataTypes.add(DataType.DT_INSTANTANEOUS_HEART_RATE);
    dataTypes.add(DataType.DT_INSTANTANEOUS_STRESS);
    dataTypes.add(HealthDataTypes.DT_INSTANTANEOUS_BLOOD_PRESSURE);
    dataTypes.add(HealthDataTypes.DT_INSTANTANEOUS_BLOOD_GLUCOSE);
    dataTypes.add(HealthDataTypes.DT_INSTANTANEOUS_SPO2);
    Task&amp;lt;Map&amp;lt;DataType, SamplePoint&amp;gt;&amp;gt; readLatestDatas = dataController.readLatestData(dataTypes);

    // 2. Calling the data controller to query the latest data is an asynchronous operation.
    // Therefore, a listener needs to be registered to monitor whether the data query is successful or not.
    readLatestDatas.addOnSuccessListener(new OnSuccessListener&amp;lt;Map&amp;lt;DataType, SamplePoint&amp;gt;&amp;gt;() {
        @Override
        public void onSuccess(Map&amp;lt;DataType, SamplePoint&amp;gt; samplePointMap) {
            logger("Success read latest data from HMS core");
            if (samplePointMap != null) {
                for (DataType dataType : dataTypes) {
                    if (samplePointMap.containsKey(dataType)) {
                        showSamplePoint(samplePointMap.get(dataType));
                        handleData(dataType);
                    } else {
                        logger("The DataType " + dataType.getName() + " has no latest data");
                    }
                }
            }
        }
    });
    readLatestDatas.addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(Exception e) {
            String errorCode = e.getMessage();
            String errorMsg = HiHealthStatusCodes.getStatusCodeMessage(Integer.parseInt(errorCode));
            logger(errorCode + ": " + errorMsg);
        }
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;DataType&lt;/strong&gt; object contains the specific data type and data value. You can obtain the corresponding data by parsing the object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Personal health records make it much easier for users to stay informed about their health. The health records help track health data over specific periods of time, such as week-by-week or month-by-month, providing invaluable insight, to make proactive health a day-to-day reality. When developing a health app, integrating data-related capabilities can help streamline the process, allowing you to focus your energy on app design and user features, to bring users a smart handy health assistant.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>hmscore</category>
    </item>
    <item>
      <title>How Can an App Send Push Messages to Users of Another App</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Thu, 28 Jul 2022 08:54:17 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-can-an-app-send-push-messages-to-users-of-another-app-10h7</link>
      <guid>https://dev.to/hmosdevelopers/how-can-an-app-send-push-messages-to-users-of-another-app-10h7</guid>
      <description>&lt;p&gt;As online shopping for products and services becomes more and more popular, new business opportunities have also arisen. To seize such opportunities, I recently developed an online shopping app, which I shall refer to in this article as "app B". Once you have developed an app, the next thing that you need to do is to promote the app and attract more users to use it. Since sending push messages to users is a widely used method for promoting apps and improving user engagement, I decided to do the same for my new app in order to deliver promotional information and various coupons to users, which hopefully should increase their engagement and interest. However, I discovered a glaring problem straightaway. Since the app has just been released, it has few registered users, making it hard to achieve the desired promotional effect by just sending push messages to these users. What I needed to do was to send push messages to a large pool of existing users in order to get them to try out my new app. It suddenly occurred to me that I once developed a very popular short video app (which I shall refer to as "app A"), which has now accumulated millions of registered users. Wouldn't it be great if there was a one-stop service that I can use to get app B to send push messages to the wide user base of app A, thus attracting users of app A to use app B? Fortunately, I discovered that the multi-sender function in &lt;a href="https://developer.huawei.com/consumer/en/hms/huawei-pushkit/?ha_source=hms3" rel="noopener noreferrer"&gt;HMS Core Push Kit&lt;/a&gt; empowers different apps to send push messages to a specific app — a function that fits my situation perfectly. Therefore, I decided to integrate Push Kit and use its multi-sender function to allow app B to send promotional push messages and coupons to users of app A.&lt;/p&gt;

&lt;p&gt;The entire integration and configuration process of Push Kit's multi-sender function is straightforward, which I'll demonstrate below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Procedure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  I. Preparations
&lt;/h3&gt;

&lt;p&gt;Before using the multi-sender function, we'll need to integrate the Push SDK into app A. You can find the detailed integration guide &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-agc-0000001050170137?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt;. In this article, I won't be describing the integration steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  II. Configuring the Multi-sender Function
&lt;/h3&gt;

&lt;p&gt;After integrating the SDK into app A, we then need to configure the multi-sender function for app B. The detailed procedure is as follows:&lt;/p&gt;

&lt;p&gt;i. Sign in to AppGallery Connect, click &lt;strong&gt;My projects&lt;/strong&gt;, and click the project to which app B belongs. Then, go to &lt;strong&gt;Grow&lt;/strong&gt; &amp;gt; &lt;strong&gt;Push Kit&lt;/strong&gt; &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt;, select app B, and view and record the sender ID of app B (ID of the project to which app B belongs), as shown in the screenshot below. Note that the sender ID is the same as the project ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3n1dyw4rksc5v6xmf3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3n1dyw4rksc5v6xmf3q.png" alt="Image description" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ii. Switch to the project to which app A belongs, select app A, and click &lt;strong&gt;Add&lt;/strong&gt; in the &lt;strong&gt;Multiple senders&lt;/strong&gt; area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbphv8kgkpvp2av4g3zqa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbphv8kgkpvp2av4g3zqa.png" alt="Image description" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;iii. In the dialog box displayed, enter the sender ID of app B and click &lt;strong&gt;Save&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;After doing so, app B acquires the permission to send push messages to app A. &lt;br&gt;
On the permission card displayed under &lt;strong&gt;Multiple senders&lt;/strong&gt;, we can specify whether to allow app B to send push messages to app A as required. &lt;/p&gt;
&lt;h3&gt;
  
  
  III. Applying for a Push Token for App B
&lt;/h3&gt;

&lt;p&gt;After configuring the multi-sender function, we need to make some changes to app A.&lt;/p&gt;

&lt;p&gt;i. Obtain the &lt;strong&gt;agconnect-services.json&lt;/strong&gt; file of app A from AppGallery Connect, and copy the file to the root directory of app A in the project.&lt;/p&gt;

&lt;p&gt;Note that the &lt;strong&gt;agconnect-services.json&lt;/strong&gt; file must contain the &lt;strong&gt;project_id&lt;/strong&gt; field. If the file does not contain the field, you need to download the latest file and replace the existing file with the latest one. Otherwise, an error will be reported when &lt;strong&gt;getToken()&lt;/strong&gt; is called.&lt;/p&gt;

&lt;p&gt;ii. Call the &lt;strong&gt;getToken()&lt;/strong&gt; method in app A to apply for a push token for app B.&lt;/p&gt;

&lt;p&gt;The sample code is as follows. Note that &lt;strong&gt;projectId&lt;/strong&gt; in the sample code indicates the sender ID of app B.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MainActivity extends AppCompatActivity {
    private void getSubjectToken() {
        // Create a thread.
        new Thread() {
            @Override
            public void run() {
                try {
                    // Set the project ID of the sender (app B).
                    String projectId = "Sender ID";                    
                    // Apply for a token for the sender (app B).
                    String token = HmsInstanceId.getInstance(MainActivity.this).getToken(projectId);
                    Log.i(TAG, "get token:" + token);

                    // Check whether the push token is empty.
                    if(!TextUtils.isEmpty(token)) {
                        sendRegTokenToServer(token);
                    }
                } catch (ApiException e) {
                    Log.e(TAG, "get token failed, " + e);
                }
            }
        }.start();
    }
    private void sendRegTokenToServer(String token) {
        Log.i(TAG, "sending token to server. token:" + token);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  IV. Sending Push Messages to App A
&lt;/h3&gt;

&lt;p&gt;After obtaining the push token, app A will send the push token to app B. Then, app B can send push messages to app A based on an access token.&lt;/p&gt;

&lt;p&gt;i. Follow the instructions &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/oauth2-0000001212610981#section128682386159?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt; to obtain an access token for the sender (app B). &lt;/p&gt;

&lt;p&gt;ii. Call the downlink messaging API in app B to send push messages to app A. &lt;/p&gt;

&lt;p&gt;The URL for calling the API using HTTPS POST is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST https://push-api.cloud.huawei.com/v2/projectid/messages:send
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the URL, &lt;strong&gt;projectid&lt;/strong&gt; indicates the sender ID of app B.&lt;/p&gt;

&lt;p&gt;The following is an example of the downlink message body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "validate_only": false,
    "message": {
        "android": {
            "notification": {
                "title": "test title",
                "body": "test body",
                "click_action": {
                    "type": 3
                }
            }
        },
"token": ["Push token applied for the sender"]
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, app B can send push messages to users of app A.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;User acquisition is an inevitable challenge for newly developed apps, but is also the key for the new apps to achieve business success. Driven by this purpose, developers usually take advantage of all available resources, including sending promotional push messages to acquire users for their new apps. However, these developers usually encounter the same problem, that is, where to find potential users and how to send push messages to such users.&lt;/p&gt;

&lt;p&gt;In this article, I demonstrated how I solve this challenge by utilizing Push Kit's multi-sender function, which allows my newly developed app to send promotional push messages to the large use base of an existing app to quickly acquire its users. The whole integration process is straightforward and cost-efficient, and is an effective way to allow multiple apps to send push messages to a specific app.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Help College Students Avoid Phone Scams</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Thu, 28 Jul 2022 08:51:00 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/how-to-help-college-students-avoid-phone-scams-1n5l</link>
      <guid>https://dev.to/hmosdevelopers/how-to-help-college-students-avoid-phone-scams-1n5l</guid>
      <description>&lt;p&gt;As the start of the new academic year approaches, many college students will be leaving their parents to start college life. However, a lack of experience makes it easy for college students to become victims of electronic fraud such as phone scams.&lt;/p&gt;

&lt;p&gt;The start of the new academic year is often a period of time that sees an uptick in phone scams, especially those targeting college students. Some scammers trick students to download and register an account on malicious financial apps embedded with viruses and Trojan horses or ones that imitate legitimate apps. With such malicious apps installed on students' phones, scammers are able to steal students' sensitive data, such as bank card numbers and passwords. Some scammers trick students, by offering them small gifts or coupons, to scan QR codes which then direct them to pages that ask users to enter their personal information, such as their phone number and address. Once a student has done this, they will receive a large number of fraudulent calls and junk SMS messages from then on. If the students scan QR codes linking to phishing websites, their personal data may be leaked and sold for malicious purposes. Some scammers even lie about offering students scholarships or grants, in order to trick them into visiting phishing websites and entering their bank account numbers and passwords, causing significant financial losses to such students.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjaxe3135bzijw5z9e77.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjaxe3135bzijw5z9e77.jpg" alt="Image description" width="800" height="527"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To deal with the ever-changing tricks of fraudsters, an app needs to detect phishing websites, malicious apps, and other risks and remind users to be on the lookout for such risks with in-app tips, in order to keep users and their data safe. So, is there a one-stop service that can enhance app security from multiple dimensions?&lt;/p&gt;

&lt;p&gt;Fortunately, HMS Core &lt;a href="https://developer.huawei.com/consumer/en/hms/huawei-safetydetectkit/?ha_source=hms3" rel="noopener noreferrer"&gt;Safety Detect&lt;/a&gt; can help developers quickly build security capabilities into their apps, and help vulnerable user groups such as college students safeguard their information and property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrb963eacnvltubkgayx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrb963eacnvltubkgayx.jpg" alt="Image description" width="752" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Security-Guides/appscheck-0000001050154380?ha_source=hms3" rel="noopener noreferrer"&gt;AppsCheck&lt;/a&gt; API in Safety Detect allows your app to obtain a list of malicious apps installed on a user's device. The API can identify 99% of malicious apps and detect unknown threats based on app behavior. Your app can then use this information to determine whether to restrict users from performing in-app payments and other sensitive operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9e4c3fjvvyam5pmdvif.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9e4c3fjvvyam5pmdvif.gif" alt="Image description" width="576" height="1181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;URLCheck&lt;/strong&gt; API in Safety Detect checks whether an in-app URL is malicious. If the URL is determined to be malicious, the app can warn the user of the risk or block the URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbgsiqrzr84pxm8s1htj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbgsiqrzr84pxm8s1htj.png" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Safety Detect also provides capabilities to check system integrity and detect fake users, helping developers quickly improve their app security. The integration process is straightforward, which I'll describe below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq89emo90hkmzgeez91da.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq89emo90hkmzgeez91da.gif" alt="Image description" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftuvptp5pveebjobc95go.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftuvptp5pveebjobc95go.gif" alt="Image description" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Procedure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Preparations
&lt;/h3&gt;

&lt;p&gt;You can follow the instructions &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Security-Guides/config-agc-0000001050416303?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt; to prepare for the integration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using the AppsCheck API
&lt;/h3&gt;

&lt;p&gt;You can directly call &lt;strong&gt;getMaliciousAppsList&lt;/strong&gt; of &lt;strong&gt;SafetyDetectClient&lt;/strong&gt; to obtain a list of malicious apps. The sample code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private void invokeGetMaliciousApps() {
        SafetyDetectClient appsCheckClient = SafetyDetect.getClient(MainActivity.this);
        Task task = appsCheckClient.getMaliciousAppsList();
        task.addOnSuccessListener(new OnSuccessListener&amp;lt;MaliciousAppsListResp&amp;gt;() {
            @Override
            public void onSuccess(MaliciousAppsListResp maliciousAppsListResp) {
                // Indicates that communication with the service was successful.
                // Use resp.getMaliciousApps() to obtain a list of malicious apps.
                List&amp;lt;MaliciousAppsData&amp;gt; appsDataList = maliciousAppsListResp.getMaliciousAppsList();
                // Indicates that the list of malicious apps was successfully obtained.
                if(maliciousAppsListResp.getRtnCode() == CommonCode.OK) {
                    if (appsDataList.isEmpty()) {
                        // Indicates that no known malicious apps were detected.
                        Log.i(TAG, "There are no known potentially malicious apps installed.");
                    } else {
                        Log.i(TAG, "Potentially malicious apps are installed!");
                        for (MaliciousAppsData maliciousApp : appsDataList) {
                            Log.i(TAG, "Information about a malicious app:");
                            // Use getApkPackageName() to obtain the APK name of the malicious app.
                            Log.i(TAG, "APK: " + maliciousApp.getApkPackageName());
                            // Use getApkSha256() to obtain the APK SHA-256 of the malicious app.
                            Log.i(TAG, "SHA-256: " + maliciousApp.getApkSha256());
                            // Use getApkCategory() to obtain the category of the malicious app.
                            // Categories are defined in AppsCheckConstants.
                            Log.i(TAG, "Category: " + maliciousApp.getApkCategory());
                        }
                    }
                }else{
                    Log.e(TAG,"getMaliciousAppsList failed: "+maliciousAppsListResp.getErrorReason());
                }
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(Exception e) {
                // An error occurred during communication with the service.
                if (e instanceof ApiException) {
                    // An error with the HMS API contains some
                    // additional details.
                    ApiException apiException = (ApiException) e;
                    // You can retrieve the status code using the apiException.getStatusCode() method.
                    Log.e(TAG, "Error: " +  SafetyDetectStatusCodes.getStatusCodeString(apiException.getStatusCode()) + ": " + apiException.getStatusMessage());
                } else {
                    // A different, unknown type of error occurred.
                    Log.e(TAG, "ERROR: " + e.getMessage());
                }
            }
        });
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using the URLCheck API
&lt;/h3&gt;

&lt;p&gt;i. Initialize the &lt;strong&gt;URLCheck&lt;/strong&gt; API.&lt;/p&gt;

&lt;p&gt;Before using the &lt;strong&gt;URLCheck&lt;/strong&gt; API, you must call the &lt;strong&gt;initUrlCheck&lt;/strong&gt; method to initialize the API. The sample code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SafetyDetectClient client = SafetyDetect.getClient(getActivity());
client.initUrlCheck();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. Request a URL check.&lt;/p&gt;

&lt;p&gt;You can pass target threat types to the &lt;strong&gt;URLCheck&lt;/strong&gt; API as parameters. The constants in the &lt;strong&gt;UrlCheckThreat&lt;/strong&gt; class include the current supported threat types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class UrlCheckThreat {
    // URLs of this type are marked as URLs of pages containing potentially malicious apps (such as home page tampering URLs, Trojan-infected URLs, and malicious app download URLs).
    public static final int MALWARE = 1;
    // URLs of this type are marked as phishing and spoofing URLs.
    public static final int PHISHING = 3;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;a. Initiate a URL check request. &lt;/p&gt;

&lt;p&gt;The URL to be checked contains the protocol, host, and path but does not contain the query parameter. The sample code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String url = "https://developer.huawei.com/consumer/cn/";
SafetyDetect.getClient(this).urlCheck(url, appId, UrlCheckThreat.MALWARE, UrlCheckThreat.PHISHING).addOnSuccessListener(this, new OnSuccessListener&amp;lt;UrlCheckResponse &amp;gt;(){
    @Override
    public void onSuccess(UrlCheckResponse urlResponse) {
        if (urlResponse.getUrlCheckResponse().isEmpty()) {
        // No threat exists.
        } else {
        // Threats exist.
        }
    }
}).addOnFailureListener(this, new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception e) {
        // An error occurred during communication with the service.
        if (e instanceof ApiException) {
            // HMS Core (APK) error code and corresponding error description.
            ApiException apiException = (ApiException) e;
            Log.d(TAG, "Error: " + CommonStatusCodes.getStatusCodeString(apiException.getStatusCode()));
         // Note: If the status code is SafetyDetectStatusCode.CHECK_WITHOUT_INIT,
        // you did not call the initUrlCheck() method or you have initiated a URL check request before the call is completed.
        // If an internal error occurs during the initialization, you need to call the initUrlCheck() method again to initialize the API.
        } else {
            // An unknown exception occurred.
            Log.d(TAG, "Error: " + e.getMessage());
        }
    }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;b. Call the &lt;strong&gt;getUrlCheckResponse&lt;/strong&gt; method of the returned &lt;strong&gt;UrlCheckResponse&lt;/strong&gt; object to obtain the URL check result. &lt;/p&gt;

&lt;p&gt;The result contains &lt;strong&gt;List&lt;/strong&gt;, which includes the detected URL threat type. If the list is empty, no threat is detected. Otherwise, you can call &lt;strong&gt;getUrlCheckResult&lt;/strong&gt; in &lt;strong&gt;UrlCheckThreat&lt;/strong&gt; to obtain the specific threat code. The sample code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final EditText testRes = getActivity().findViewById(R.id.fg_call_urlResult);
List&amp;lt;UrlCheckThreat&amp;gt; list = urlCheckResponse.getUrlCheckResponse();
if (list.isEmpty()) {
        testRes.setText("ok");
    }
else{
        for (UrlCheckThreat threat : list) {
            int type = threat.getUrlCheckResult();
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iii. Close the URL check session.&lt;/p&gt;

&lt;p&gt;If your app does not need to call the &lt;strong&gt;URLCheck&lt;/strong&gt; API anymore or will not need to for a while, you can call the &lt;strong&gt;shutdownUrlCheck&lt;/strong&gt; method to close the URL check session and release relevant resources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SafetyDetect.getClient(this).shutdownUrlCheck();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Electronic fraud such as phone scams are constantly evolving and becoming more and more difficult to prevent, bringing great challenges to both developers and users. To combat such risks, developers must utilize technical means to identify phishing websites, malicious apps, and other risks, in order to safeguard users' personal information and property.&lt;/p&gt;

&lt;p&gt;In this article, I demonstrated how HMS Core Safety Detect can be used to effectively combat electronic fraud. The whole integration process is straightforward and cost-efficient, and is a quick and effective way to build comprehensive security capabilities into an app.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Audio Editor Kit, a Library of Special Effects</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Fri, 15 Jul 2022 10:15:20 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/audio-editor-kit-a-library-of-special-effects-2jj1</link>
      <guid>https://dev.to/hmosdevelopers/audio-editor-kit-a-library-of-special-effects-2jj1</guid>
      <description>&lt;p&gt;Audio is a fundamental way of communication. It transcends space limitations, is easy to grasp, and comes in all forms, which is why many mobile apps that cover short videos, online education, e-books, games, and more are integrating audio capabilities. Adding special effects is a good way of freshening up audio.&lt;/p&gt;

&lt;p&gt;Rather than compiling different effects myself, I turned to &lt;a href="https://developer.huawei.com/consumer/en/hms/huawei-audio-editor/?ha_source=hms3" rel="noopener noreferrer"&gt;Audio Editor Kit&lt;/a&gt; from HMS Core for help, which boasts a range of versatile special effects generated by the voice changer, equalizer, sound effect, scene effect, sound field, style, and fade-in/out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Voice Changer
&lt;/h2&gt;

&lt;p&gt;This function alters a user's voice to protect their privacy while simultaneously spicing up their voice. Available effects in this function include: &lt;strong&gt;Seasoned&lt;/strong&gt;, &lt;strong&gt;Cute&lt;/strong&gt;, &lt;strong&gt;Male&lt;/strong&gt;, &lt;strong&gt;Female&lt;/strong&gt;, and &lt;strong&gt;Monster&lt;/strong&gt;. What's more, this function supports all languages and can process audio in real time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc34vkwk7ncibicy4m93l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc34vkwk7ncibicy4m93l.png" alt="Image description" width="436" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Equalizer
&lt;/h2&gt;

&lt;p&gt;An equalizer adjusts the tone of audio by increasing or decreasing the volume of one or more frequencies. In this way, this filter helps customize how audio plays back, making audio sound more fun.&lt;/p&gt;

&lt;p&gt;The equalizer function of Audio Editor Kit is preloaded with 9 effects: &lt;strong&gt;Pop&lt;/strong&gt;, &lt;strong&gt;Classical&lt;/strong&gt;, &lt;strong&gt;Rock&lt;/strong&gt;, &lt;strong&gt;Bass&lt;/strong&gt;, &lt;strong&gt;Jazz&lt;/strong&gt;, &lt;strong&gt;R&amp;amp;B&lt;/strong&gt;, &lt;strong&gt;Folk&lt;/strong&gt;, &lt;strong&gt;Dance&lt;/strong&gt;, and &lt;strong&gt;Chinese style&lt;/strong&gt;. The function also supports customized sound levels of 10 bands.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0agkzefccweovdnoz6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0agkzefccweovdnoz6z.png" alt="Image description" width="444" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sound Effect
&lt;/h2&gt;

&lt;p&gt;A sound effect is also a sound — or sound process — which is artificially created or enhanced. A sound effect can be applied to improve the experience of films, video games, music, and other media.&lt;/p&gt;

&lt;p&gt;Sound effects enhance the enjoyment of the content: Effective use of sound effects delivers greater immersion, which change with the plot and stimulate emotions.&lt;/p&gt;

&lt;p&gt;Audio Editor Kit provides over 100 effects (all free-to-use), which are broken down into 10 types, including &lt;strong&gt;Animals&lt;/strong&gt;, &lt;strong&gt;Automobile&lt;/strong&gt;, &lt;strong&gt;Ringing&lt;/strong&gt;, &lt;strong&gt;Futuristic&lt;/strong&gt;, and &lt;strong&gt;Fighting&lt;/strong&gt;. They, at least for me, are comprehensive enough.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0wohef7ubxa1y25e33i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0wohef7ubxa1y25e33i.png" alt="Image description" width="439" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scene Effect
&lt;/h2&gt;

&lt;p&gt;Audio Editor Kit offers this function to simulate how audio sounds in different environments by using different algorithms. It now has four effects: &lt;strong&gt;Underwater&lt;/strong&gt;, &lt;strong&gt;Broadcast&lt;/strong&gt;, &lt;strong&gt;Earpiece&lt;/strong&gt;, and &lt;strong&gt;Gramophone&lt;/strong&gt;, which deliver a high level of authenticity, to immerse users of music apps, games, and e-book reading apps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qp3x1ugz62xo5usidut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qp3x1ugz62xo5usidut.png" alt="Image description" width="438" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sound Field
&lt;/h2&gt;

&lt;p&gt;A sound field is a region of a material medium where sound waves exist. Sound fields with different positions deliver different effects.&lt;/p&gt;

&lt;p&gt;The sound field function of Audio Editor Kit offers 4 options: &lt;strong&gt;Near&lt;/strong&gt;, &lt;strong&gt;Grand&lt;/strong&gt;, &lt;strong&gt;Front-facing&lt;/strong&gt;, and &lt;strong&gt;Wide&lt;/strong&gt;, which incorporates the preset attributes of reverb and panning.&lt;/p&gt;

&lt;p&gt;Each option is suitable for a different kind of music: &lt;strong&gt;Near&lt;/strong&gt; for soft folk songs, &lt;strong&gt;Front-facing&lt;/strong&gt; for absolute music, &lt;strong&gt;Grand&lt;/strong&gt; for music with a large part of bass and great immersion (such as rock music and rap music), and &lt;strong&gt;Wide&lt;/strong&gt; for symphonies. They can be used during audio/video creation or music playback on different music genres, to make music sound more appealing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjvf3l6bvcvqqdyvk1r0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjvf3l6bvcvqqdyvk1r0l.png" alt="Image description" width="429" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Style
&lt;/h2&gt;

&lt;p&gt;A music style — or music genre — is a musical category that identifies pieces of music with common elements in terms of tune, rhythm, tone, beat, and more.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Style&lt;/strong&gt; function of Audio Editor Kit offers the bass boost effect, which makes audio sound more rhythmic and expressive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk14w91o3tt9wx1ley4ll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk14w91o3tt9wx1ley4ll.png" alt="Image description" width="436" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fade-in/out
&lt;/h2&gt;

&lt;p&gt;The fade-in effect gradually increases the volume from zero to a specified value, whereas fade-out does just the opposite. Both of them deliver a smooth music playback.&lt;/p&gt;

&lt;p&gt;This can be realized by using the fade-in/out function from Audio Editor Kit, which is ideal for creating a remix of songs or videos.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02jl5j2yiy00yfzgzk1h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02jl5j2yiy00yfzgzk1h.png" alt="Image description" width="434" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stunning effects, aren't they?&lt;/p&gt;

&lt;p&gt;Audio Editor Kit offers a range of other services for developing a mighty audiovisual app, including basic audio processing functions (like import, splitting, copying, deleting, and audio extraction), 3D audio rendering (audio source separation and spatial audio), and AI dubbing.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/Media-Guides/featured_functions-0000001178963356/?ha_source=hms3" rel="noopener noreferrer"&gt;development guide&lt;/a&gt; of Audio Editor Kit and don't forget to give it a try!&lt;/p&gt;

</description>
      <category>news</category>
      <category>hmscore</category>
    </item>
    <item>
      <title>General Card Recognition: Easier Card Binding, and More</title>
      <dc:creator>Jackson</dc:creator>
      <pubDate>Fri, 15 Jul 2022 10:11:17 +0000</pubDate>
      <link>https://dev.to/hmosdevelopers/general-card-recognition-easier-card-binding-and-more-3af9</link>
      <guid>https://dev.to/hmosdevelopers/general-card-recognition-easier-card-binding-and-more-3af9</guid>
      <description>&lt;p&gt;Cards come in all shapes and sizes, which apps don't like. The different layout of details and varying number lengths make it difficult for an app to automatically recognize key details, meaning the user has to manually enter membership card details or driving license details to verify themselves before using an app or for other purposes.&lt;/p&gt;

&lt;p&gt;Fortunately, the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/hiai-Guides/general-card-recognition-0000001050040073?ha_source=hms3" rel="noopener noreferrer"&gt;General Card Recognition&lt;/a&gt; service from HMS Core ML Kit can universally recognize any card. By customizing the post-processing logic of the service (such as determining the length of a card number, or whether the number follows some specific letters), you can enable your app to recognize and obtain details from any scanned card.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Introduction
&lt;/h2&gt;

&lt;p&gt;The general card recognition service is built upon text recognition technology, providing a universal development framework. It supports cards with a fixed format — such as the Exit-Entry Permit for Traveling to and from Hong Kong and Macao, Hong Kong identity card, Mainland Travel Permit for Hong Kong and Macao Residents, driver's licenses of many countries/regions, and more. For such documents, you can customize the post-processing logic so that the service extracts only the desired information.&lt;/p&gt;

&lt;p&gt;The service now offers three types of APIs, meaning it can recognize scanned cards from the camera stream, photos taken with the device camera, and those stored in local images. It also supports customization of the recognition UI, for easy usability and flexibility.&lt;/p&gt;

&lt;p&gt;The GIF below illustrates how the service works in an app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1a7rugnqojmyyqzalyb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1a7rugnqojmyyqzalyb.gif" alt="Image description" width="280" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;The general card recognition service allows card information to be quickly collected, enabling a card to be smoothly bound to an app.&lt;/p&gt;

&lt;p&gt;This is ideal when a user tries to book a hotel or air tickets for their journey, as they can quickly input their card details and complete their booking without the risk of losing out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Features
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Multi-card support&lt;/strong&gt;: General card recognition covers a wider range of card types than those covered by the text recognition, ID card recognition, and bank card recognition services.&lt;/p&gt;

&lt;p&gt;This service can recognize any card with a fixed format, including the membership card, employee card, pass, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-angle support&lt;/strong&gt;: The service can recognize information from a card with a tilt angle of up to 30 degrees, and is able to recognize scanned cards that have a curved text with a bending angle of up to 45 degrees. Under ideal conditions, the service can deliver a recognition accuracy of as high as 90%.&lt;/p&gt;

&lt;p&gt;I got to know how to integrate this service &lt;a href="https://developer.huawei.com/consumer/en/doc/development/hiai-Guides/general-card-recognition-0000001050040073#section527710194118?ha_source=hms3" rel="noopener noreferrer"&gt;here&lt;/a&gt;. FYI, I also find &lt;a href="https://developer.huawei.com/consumer/en/doc/development/hiai-Guides/service-introduction-0000001050040017#section119422313385?ha_source=hms3" rel="noopener noreferrer"&gt;other services of ML Kit&lt;/a&gt; intriguing and useful.&lt;/p&gt;

&lt;p&gt;Look forward to seeing you in the comments section to know what ideas you've got for using the general card recognition service.&lt;/p&gt;

</description>
      <category>news</category>
      <category>hmscore</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
