<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mine KULAÇ AKKULAK on Medium]]></title>
        <description><![CDATA[Stories by Mine KULAÇ AKKULAK on Medium]]></description>
        <link>https://medium.com/@mine1810?source=rss-936bf0710fc6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-iMisnQ4oCfMnLj0</url>
            <title>Stories by Mine KULAÇ AKKULAK on Medium</title>
            <link>https://medium.com/@mine1810?source=rss-936bf0710fc6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:15:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mine1810/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HMS Core 5.0 released with new services and improvements]]></title>
            <link>https://medium.com/huawei-developers/hms-core-5-0-released-with-new-services-and-improvements-8a5641633f44?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a5641633f44</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[hms-core]]></category>
            <category><![CDATA[huawei-updates]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Fri, 17 Jul 2020 11:36:23 GMT</pubDate>
            <atom:updated>2020-07-17T11:36:57.689Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*uXP3Sfyy85SAxS_PLNPpbg.png" /></figure><h3>What’s new?</h3><p>Huawei has launched 7 new developer kits. These kits will provide more capabilities to develop new features within Media, Graphics and System categories.</p><ol><li><strong>Audio Kit</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCfiqSWBDUizU3k_DsbZ9Q.png" /></figure><p>HUAWEI Audio Kit is a set of audio capabilities developed by Huawei. It provides you with audio playback, audio playback, audio effects, and audio data capabilities based on the HMS Core ecosystem, including audio encoding and decoding capabilities at the hardware level and system bottom layer.</p><p><strong>Documents :</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050749665">Document</a></p><p><strong>Codelab :</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSAudioKit/index.html#0">Audio Kit</a></p><p><strong>2.</strong> <strong>Image Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_be3kaSv_qhdHNdgwZE2zQ.png" /></figure><p>HUAWEI Image Kit incorporates powerful scene-specific smart design and animation production functions into your app, giving it the power of efficient image content reproduction while providing abetter image editing experience for your users. It provides 24 unique color filters, 9 advanced animation effects, and supports five basic animations and any of their combinations.</p><p><strong>Documents :</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-introduction-0000001050199011">Document</a></p><p><strong>Codelab :</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSImageKit/index.html#0">Image Kit</a></p><p><strong>3.</strong> <strong>Video Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fssEV-4NdXLVwgnQATSbKw.png" /></figure><p>HUAWEI Video Kit provides Smoother HD video playback bolstered by wide-ranging control options, raises the ceiling for your app and makes it more appealing. It will support video editing and video hosting in later versions, helping you quickly build desired video features to deliver a superb video experience to your app users.</p><p><strong>Documents :</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050439577">Document</a></p><p><strong>Codelab :</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSVideoKit/index.html#0">HUAWEI Video Kit</a></p><p><strong>4. Accelerate Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLPiOorVOeW-Z1h_dBtvlw.png" /></figure><p>HUAWEI Accelerate Kit provides the multi-thread acceleration capability that efficiently improves concurrent execution of multiple threads. It is located above the kernel in the OS and opened to developers as a set of C-language APIs. Most of current Android devices run a multi-core system. To give full play to the system, programs of executing multiple tasks concurrently are preferred. Generally, multi-thread programs at the native layer control task execution by managing threads. Accelerate Kit provides a new multi-thread programming method by using the multi-thread library. It frees you from thread management details so that you can focus on developing apps that can fully utilize the multi-core hardware capability of the system, promising more efficient running.</p><p><strong>Documents:</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050980807">Document</a></p><p><strong>Codelab:</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSAccKit/index.html#0">Accelerate Kit</a></p><p><strong>5.</strong> <strong>Computer Graphics Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knDuZRfa3fzA45kUq7qupg.png" /></figure><p>CG Rendering Framework, a key capability of HUAWEI Computer Graphics (CG) Kit, is a Vulkan-based high-performance rendering framework that consists of the PBR material, model, texture, light, and component systems, and more. This rendering framework is designed for Huawei device development kit (DDK) features and implementation details to provide the best 3D rendering capabilities on Huawei devices using Kirin SoCs. In addition, the framework supports secondary development, with reduced difficulty and complexity, which therefore helps significantly increase the development efficiency.</p><p><strong>Documents:</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050197938">Document</a></p><p><strong>Codelab:</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSCGKit/index.html#0">CG Rendering Framework</a></p><p><strong>6.</strong> <strong>Scene Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXSdYeq10F7slpmgY1HR0Q.png" /></figure><p>HUAWEI Scene Kit is a lightweight rendering engine that features high performance and low consumption. It provides advanced descriptive APIs for you to edit, operate, and render 3D materials. It is extensively applicable to various scenarios that need image rendering, such as gaming, shopping, education, social networking, and design.</p><p><strong>Documents:</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050439577">Document</a></p><p><strong>Codelab:</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSSceneKit/index.html#0">Scene Kit</a></p><p><strong>7.</strong> <strong>hQUIC Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZTHcYjNB3GW4f3IG1da6A.png" /></figure><p>hQUIC Kit gives your apps low latency, high throughput, and secure and reliable communications capabilities. It supports both gQUIC, iQUIC and Cronet protocols and provides intelligent congestion control algorithms to avoid congestions in different network environments, giving your apps faster connection establishment, reduced packet loss, and higher throughput.</p><p><strong>Documents:</strong></p><p><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050440045">Document</a></p><p><strong>Codelab:</strong></p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMShQUICKit/index.html#0">hQUIC Kit</a></p><h3><strong>Improvements</strong></h3><p>Some improvements have also been made to existing services in the HMS Core 5.0 version. In this part we will examine this improvements and features. HMS Core 5.0.0, brings the following updates:</p><h4><strong>1-</strong> <strong>Location Services</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zwdgn3vkI0AK7MbGmuq9Rw.png" /></figure><p>It supports network positioning Crowd-sourcing and Fence Management capabilities.</p><ul><li>Added the 3D elevated road API.</li><li>Added the function of managing geofences on the cloud.</li></ul><h4><strong>2-</strong> <strong>Push services</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QlfCCsGiWE2RlZhbLYTZyQ.png" /></figure><p>It supports LBS and Contextual Push.</p><ul><li><strong>Supported </strong><a href="https://developer.huawei.com/consumer/en/doc/HMSCore-Guides-V5/automated-notifications-0000001051072150-V5"><strong>Automated Notification (Beta)</strong></a></li></ul><p><strong>Automated Notification (Beta): </strong>Different from common messaging, the automated notification can push messages to users at an appropriate time point, in an appropriate location, and under an appropriate scenario, including: headset inserted, Bluetooth car kit disconnected, DND canceled, holiday, weekend, UV intensity, and temperature. This greatly improves the tap-through rate of messages as well as user activeness and loyalty. In short, it makes push notifications smarter. You can find more detail in this page about <a href="https://developer.huawei.com/consumer/en/doc/HMSCore-Guides-V5/automated-notifications-0000001051072150-V5">Automated Notification</a>.</p><h4><strong>3-</strong> <strong>Optimizes some service experiences</strong></h4><p><strong>Analytics Kit 5.0.1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fytaDW8EPl_JMKuag1XE1Q.png" /></figure><p>Added the analytics plugin to check whether the necessary preparations for integrating the HMS Core Analytics SDK are complete.</p><p><strong>Dynamic Tag Manager 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HoDBn3r_Z7bdnr4l4pCsVA.png" /></figure><p>Added the capability to add visual events for Android apps.</p><p>Added the Facebook Analytics extension template.</p><p>Solved the issue that connections cannot be set up using WebSocket.</p><p>Solved the issue that the control ID cannot be obtained.</p><p><strong>FIDO 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txpk0MqTuNhcikwSZ97d6w.png" /></figure><p>Added the Fido2Client.hasPlatformAuthenticators() API for checking whether a platform authenticator is available.</p><p>Added the Fido2Client.getPlatformAuthenticators() API for checking available platform authenticators.</p><p>Added the extended item for specifying a platform authenticator for authentication.</p><p>Added the extended item for specifying whether the private key is invalidated when a new fingerprint is enrolled on the fingerprint platform authenticator.</p><p>Added the extended item for specifying whether the fingerprint platform authenticator recognizes the fingerprint ID.</p><p><strong>Game Service 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4BX6qFVzObzNWdAgjoA7aQ.jpeg" /></figure><p>Supported HUAWEI AppTouch.</p><p><strong>Health Kit 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-uOO5WVp7IX4jVu1wApxQ.png" /></figure><p>The DFX capability is enhanced to cover more service scenarios.</p><p>Data from the HUAWEI Health app can be integrated into HMS Health Kit. (Data that can be integrated includes the step count data, sleep data, blood glucose, blood pressure, heart rate data, and weight data.)</p><p><strong>Map Kit 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E_M3iMzMgivQPz8GRda00A.png" /></figure><p>Added API key authentication. You can set an API key in either of the following ways:</p><p>Set the api_key field in the agconnect-services.json file.</p><p>Call the MapsInitializer.setApiKey(String) method.</p><p><strong>Nearby Service 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJ9g-5sg4Rw25C5ds2XK4Q.png" /></figure><p>Added the message engine function to support messaging rule configuration on the console of HUAWEI Developers.</p><p><strong>Safety Detect 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Y83AY3_xlA_KbKoz-nFlg.jpeg" /></figure><p>Improved the efficiency of non-first time Safety Detect SDK synchronization.</p><p>Fixed the issue that HMS Core (APK) cannot be called on some non-Huawei phones.</p><p><strong>Site Kit 5.0.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qCnIlj8MaFDWGMEXwzpc1Q.png" /></figure><p>Added the search widget.</p><p>Added the HwPoiType parameter, which indicates the Huawei POI type.</p><p><strong>Thank you so much for reading and taking time.</strong> See you in next posts.</p><p><a href="https://forums.developer.huawei.com/forumPortal/en/home">HUAWEI Developer Forum | HUAWEI Developer</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a5641633f44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/hms-core-5-0-released-with-new-services-and-improvements-8a5641633f44">HMS Core 5.0 released with new services and improvements</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhanced mobile app security via SysIntegrity API of Safety Detect]]></title>
            <link>https://medium.com/huawei-developers/enhanced-mobile-app-security-via-sysintegrity-api-of-safety-detect-de83a2b3b5d1?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/de83a2b3b5d1</guid>
            <category><![CDATA[huawei-mobile-service]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[safety-defect]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Wed, 24 Jun 2020 11:37:59 GMT</pubDate>
            <atom:updated>2020-06-29T06:44:20.994Z</atom:updated>
            <content:encoded><![CDATA[<h3>HUAWEI Safety Detect: Ensuring device system integrity for enhanced mobile app security using SysIntegrity API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iz9GJDe0-OG85Pxif2N2sA.png" /></figure><h3>Opportunity</h3><p>As more people depend on apps for online banking, electronic commerce, instant messaging, and business-related functions, guarding against security threats becomes an utmost importance from both the developers’ perspective and app users’ perspective. Developers pay thorough attention to app development with the intention of providing their end users with a secure app and best- in-class app usage experience. To ensure app security and best-in-class app usage experience, system integrity of the device running the app must also be ensured.</p><h3>What is SysIntegrity API of HUAWEI Safety Detect?</h3><p>HUAWEI Safety Detect builds robust security capabilities into your app to effectively protect it against security threats. One of these capabilities is system integrity check, which checks whether the device running your app is secure. This capability is enabled by the SysIntegrity API, which performs dynamic system integrity evaluation in the secure boot process in a Trusted Execution Environment (TEE). The system integrity evaluation result is signed by the TSMS server using the X.509 digital certificate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*c-aTiNobKl9S90aWPa4rfw.png" /><figcaption>Screenshot from Huawei Developers, <em>Make your apps secure with HUAWEI Safety Detect</em> (0:40), depicting the evaluation of the device system to detect whether it is rooted and unlocked, and to spot privilege escalation</figcaption></figure><h3>How to use the SysIntegrity API of HUAWEI Safety Detect?</h3><p>To use the SysIntegrity API, the correct version of HMS Core must be installed on the user’s device. The <strong>isHuaweiMobileServicesAvailable()</strong> method could be called to check on whether the HMS Core version is compatible with the Safety Detect SDK version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*e72tE1GT_9J9kCrjSv_Egw.png" /></figure><p>The app user must be asked to update the HMS version if the installed version is not compatible with the Android SDK version to ensure proper app operation.</p><h3>To call the SysIntegrity API of Safety Detect</h3><ol><li>Obtain a nonce value.</li></ol><p>The nonce value will be used to determine whether the returned result corresponds to the request and did not encounter any replay attacks. The nonce value must contain a minimum of 16 bytes and is intended to be used only once.</p><p>2. Request for the SysIntegrity API using the nonce value and the <strong>appId</strong> as input parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*kJ41djPWVV28zCsfrop2Tw.png" /></figure><p>3. Verify the check result on your server.</p><p>a. Parse the JSON Web Signature format result to get a <strong>header</strong>, <strong>payload</strong>, and <strong>signature</strong>.</p><p>b. Get a certificate chain from the obtained <strong>header</strong> and verify it using the <a href="https://communityfile-drcn.op.hicloud.com/FileServer/getFile/cmtyManage/011/111/111/0000000000011111111.20200609145234.05368532954604052329176607732258:50510609081300:2800:F40DD11227F86D357EB9C89EE85A037253E2417F142BC8D4DE576B63C6740223.zip?needInitFileName=true">HUAWEI CBG Root CA certificate</a>.</p><p>c. Confirm whether the domain name of the leaf certificate in the certificate chain is <strong>sysintegrity.platform.hicloud.com</strong>.</p><p>d. Verify the signature obtained from the <strong>signature</strong>.</p><p>e. Get the integrity verification result from the obtained <strong>payload</strong>.</p><p>Refer to the following format and example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*cs8Qas6ULO9F7FY76OAUGw.png" /></figure><p>Developers can decide on whether to remind users of the risks based on their security requirements if the value of <strong>basicIntegrity</strong> is<strong> false</strong> in the check result.</p><h3>The Benefits</h3><h3>To the developer</h3><p>Developers could improve the security of their apps by also checking the system integrity of the device running their app, thus increasing app credibility.</p><h3>To the end users</h3><p>End users are empowered to evaluate security risks and take appropriate measures by being aware of device vulnerabilities.</p><h3>Learn More</h3><p>To know more information on how to maximize the features and advantages of HUAWEI Safety Detect, go to <a href="https://developer.huawei.com/consumer/en/hms/huawei-safetydetectkit">https://developer.huawei.com/consumer/en/hms/huawei-safetydetectkit</a>.</p><p><strong>Work cited</strong></p><p>HUAWEI Developers. (2020, March 4). <em>Make your apps secure with HUAWEI Safety Detect</em> [Video File], YouTube. Retrieved from <a href="https://youtu.be/WFbM63JkvzA">https://youtu.be/WFbM63JkvzA</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de83a2b3b5d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/enhanced-mobile-app-security-via-sysintegrity-api-of-safety-detect-de83a2b3b5d1">Enhanced mobile app security via SysIntegrity API of Safety Detect</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to draw a route and show route steps with HMS Direction API]]></title>
            <link>https://medium.com/huawei-developers/how-to-draw-a-route-and-show-route-steps-with-hms-direction-api-8593857e18a7?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8593857e18a7</guid>
            <category><![CDATA[mapkit]]></category>
            <category><![CDATA[directions-api]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 11:55:33 GMT</pubDate>
            <atom:updated>2020-03-31T11:55:33.869Z</atom:updated>
            <content:encoded><![CDATA[<h3>Draw a route and show route steps with Huawei — HMS Direction API</h3><p>Hello everyone,</p><p>In this tutorial, I will guide you how to use HMS Direction API, draw a route with polyline and show direction steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYeX5qoFJD5WqKeCmFaagg.jpeg" /></figure><p>I assume you set up the HMS Map Kit, if not please check <a href="https://medium.com/@mine1810/how-to-integrate-hms-map-kit-add-marker-and-draw-circle-176df7f0de8f">this tutorial</a>. Also, for this tutorial we need to use Retrofit and Gson libraries.</p><p>Let’s start with adding libraries</p><pre>dependencies {<br>    implementation &#39;com.google.code.gson:gson:2.8.6&#39;<br>    implementation &#39;com.squareup.retrofit2:retrofit:2.7.2&#39;<br>    implementation &#39;com.squareup.retrofit2:converter-gson:2.7.2&#39;<br>}</pre><h3>Define API settings</h3><p>First, we need to define our retrofit connection</p><pre>class DirectionsRetrofit {<br> <br>     private val retrofit: Retrofit = Retrofit.Builder()<br>         .baseUrl(Constants().BASE_URL_DIRECTIONS)<br>         .client(setInterceptors())<br>         .addConverterFactory(GsonConverterFactory.create())<br>         .build()<br> <br>     fun &lt;S&gt; createService(serviceClass: Class&lt;S&gt;?): S {<br>         return retrofit.create(serviceClass)<br>     }<br> <br>     private fun setInterceptors() : OkHttpClient{<br>         val logger = HttpLoggingInterceptor()<br>         logger.<em>level </em>= HttpLoggingInterceptor.Level.BODY<br> <br>         return OkHttpClient.Builder()<br>             .readTimeout(60,TimeUnit.SECONDS)<br>             .connectTimeout(60,TimeUnit.SECONDS)<br>             .addInterceptor <strong>{ </strong>chain <strong>-&gt;<br>                 </strong>val url: HttpUrl = chain.request().url().newBuilder()<br>                     .addQueryParameter(&quot;key&quot;, &quot;YOUR_API_KEY&quot;)<br>                     .build()<br>                 val request = chain.request().newBuilder()<br>                     .header(&quot;Content-Type&quot;,&quot;application/json&quot;)<br>                     ./service/https://medium.com/url(url)<br>                     .build()<br>                 chain.proceed(request)<br>             <strong>}<br>             </strong>.addInterceptor(logger)<br>             .build()<br>     }<br> <br> }</pre><p>For Direction API request, <strong><em>API_KEY</em></strong> is necessary. We add the <em>API_KEY</em> query at our HttpClient for every request. (<em>Also you can add the Api Key at Api interface as Retrofit ”@Query”</em>).</p><p>You can find API_KEY from <strong><em>agconnect-services.json</em></strong>.</p><p>Api url is</p><pre>val BASE_URL_DIRECTIONS = &quot;https://mapapi.cloud.huawei.com/mapApi/v1/&quot;</pre><p>Retrofit interface for api service:</p><pre>interface DirectionsApis {<br>     @POST(&quot;routeService/{type}&quot;)<br>     fun getDirectionsWithType(<br>            @Path(value = &quot;type&quot;,encoded = true) type : String,<br>            @Body directionRequest: DirectionsRequest<br>     ): Call&lt;DirectionsResponse&gt;<br> }</pre><p>In here, route type can be change, with</p><pre>enum class DirectionType(val type: String) {<br>     WALKING(&quot;walking&quot;),<br>     BICYCLING(&quot;bicycling&quot;),<br>     DRIVING(&quot;driving&quot;)<br> }</pre><p>We will add the type programmatically.</p><p>Then, we need to define our repo;</p><pre>open class DirectionsBaseRepo {<br> <br>     private var directionsApis : DirectionsApis? = null<br> <br>     fun getInstance(): DirectionsApis?{<br>         if(directionsApis==null)<br>             setMainApis()<br>         return directionsApis<br>     }<br> <br>     private fun setMainApis(){<br>         directionsApis = DirectionsRetrofit().createService(DirectionsApis::class.<em>java</em>)<br>     }<br> }</pre><p>Now, we are ready to request a route.</p><p>First we need to define request data structure as follows.</p><pre>data class DirectionsRequest( <br>            @SerializedName(&quot;origin&quot;) val origin: LatLngData,<br>            @SerializedName(&quot;destination&quot;) val destination: LatLngData )</pre><pre>data class LatLngData (<br>            @SerializedName(&quot;lat&quot;) val lat: Double,<br>            @SerializedName(&quot;lng&quot;) val lng: Double )</pre><p>At our activity/fragment, we can define request object :</p><pre>private lateinit var directionRequest : DirectionsRequest</pre><pre>override fun onCreate(savedInstanceState: Bundle?) {<br>     .<br>     .<br>     val origin = LatLngData(40.9702245, 29.0706332)<br>     val destination = LatLngData(41.1106263, 29.0322126)<br>     directionRequest = DirectionsRequest(origin,destination)<br>     .<br>     . <br>     // Let’s request for walking type:<br>     getDirections(DirectionType.WALKING.type,directionRequest)<br> }</pre><pre>fun getDirections(type: String,directionRequest: DirectionsRequest){<br>     DirectionsBaseRepo().getInstance()?.getDirectionsWithType(type,directionRequest)?<br>        .enqueue(object : Callback&lt;DirectionsResponse&gt;{<br>         override fun onFailure(call: Call&lt;DirectionsResponse&gt;, t: Throwable) {<br>                     }<br> <br>         override fun onResponse(call: Call&lt;DirectionsResponse&gt;, <br>                    response: Response&lt;DirectionsResponse&gt;) {<br>             if(response.<em>isSuccessful</em>){<br>                 response.body()?.<em>let </em><strong>{<br>                     </strong>onSuccess(<strong>it </strong>as Any)<br>                 <strong>}<br>             </strong>}<br>         }<br> <br>     })<br> }</pre><p>Now, we need to define response data structure.</p><pre>data class DirectionsResponse (@SerializedName(&quot;routes&quot;) val routes: List&lt;Routes&gt;,<br>                                @SerializedName(&quot;returnCode&quot;) val returnCode: String,<br>                                @SerializedName(&quot;returnDesc&quot;) val returnDesc: String)<br></pre><pre>data class Routes (@SerializedName(&quot;paths&quot;) val paths: List&lt;Paths&gt;,<br>                    @SerializedName(&quot;bounds&quot;) val bounds: Bounds)</pre><pre><br>data class Paths (@SerializedName(&quot;duration&quot;) val duration: Double,<br>                   @SerializedName(&quot;durationText&quot;) val durationText: String,<br>                   @SerializedName(&quot;durationInTraffic&quot;) val durationInTraffic: Int,<br>                   @SerializedName(&quot;distance&quot;) val distance: Double,<br>                   @SerializedName(&quot;startLocation&quot;) val startLocation: LatLngData,<br>                   @SerializedName(&quot;startAddress&quot;) val startAddress: String,<br>                   @SerializedName(&quot;distanceText&quot;) val distanceText: String,<br>                   @SerializedName(&quot;steps&quot;) val steps: List&lt;Steps&gt;,<br>                   @SerializedName(&quot;endLocation&quot;) val endLocation: LatLngData,<br>                   @SerializedName(&quot;endAddress&quot;) val endAddress: String)</pre><pre><br>data class Bounds (@SerializedName(&quot;southwest&quot;) val southwest: LatLngData,<br>                    @SerializedName(&quot;northeast&quot;) val northeast: LatLngData)</pre><pre><br>data class Steps (@SerializedName(&quot;duration&quot;) val duration: Double,<br>                   @SerializedName(&quot;orientation&quot;) val orientation: Double,<br>                   @SerializedName(&quot;durationText&quot;) val durationText: String,<br>                   @SerializedName(&quot;distance&quot;) val distance: Double,<br>                   @SerializedName(&quot;startLocation&quot;) val startLocation: LatLngData,<br>                   @SerializedName(&quot;instruction&quot;) val instruction: String,<br>                   @SerializedName(&quot;action&quot;) val action: String,<br>                   @SerializedName(&quot;distanceText&quot;) val distanceText: String,<br>                   @SerializedName(&quot;endLocation&quot;) val endLocation: LatLngData,<br>                   @SerializedName(&quot;polyline&quot;) val polyline: List&lt;LatLngData&gt;,<br>                   @SerializedName(&quot;roadName&quot;) val roadName: String)</pre><p>At this point, we have all direction steps, and we need to use all Paths “polyline” values from Steps data to draw a route with Polyline.</p><pre>private fun addPolyLines(path : Paths){<br>     val options = PolylineOptions()<br>     options.add(LatLng(path.startLocation.lat, path.startLocation.lng))<br>     path.steps.<em>forEach</em><strong>{<br>         it</strong>.polyline.<em>forEach </em><strong>{</strong>it1<strong>-&gt;<br>             </strong>options.add(LatLng(it1.lat, it1.lng))<br>         <strong>}<br>     }<br>     </strong>options.add(LatLng(path.endLocation.lat, path.endLocation.lng))<br>     options.color(Color.<em>BLUE</em>)<br>     options.width(10f)<br>     hMap.addPolyline(options)<br> }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJeYbENeB2Pz8Wr4jf6teQ.jpeg" /></figure><p>Let’s request for bicycling type:</p><pre>getDirections(DirectionType.BICYCLING.type,directionRequest)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBIvAlS8e12_b-lRc4WYPw.jpeg" /></figure><p>Let’s request for driving type:</p><pre>getDirections(DirectionType.DRIVING.type,directionRequest)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdnH50Txxi85sto_BSew3w.jpeg" /></figure><p>So far, we drew the route on the map. Now let’s show the steps we received from direction api at <em>BottomSheetDialog</em>.</p><p>We need to create a layout for BottomSheetDialog. “<em>bottom_sheet_content_view</em>”</p><pre>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>     android:layout_width=&quot;match_parent&quot;<br>     android:layout_height=&quot;wrap_content&quot;<br>     android:orientation=&quot;vertical&quot;<br>     android:padding=&quot;16dp&quot;&gt;<br> <br>     &lt;TextView<br>         android:id=&quot;@+id/directionStepsMainInfo&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;?attr/actionBarSize&quot;<br>         android:gravity=&quot;center_vertical&quot;<br>         android:textColor=&quot;@color/colorAccent&quot;<br>         android:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; /&gt;<br> <br>     &lt;TextView<br>         android:id=&quot;@+id/directionStepsVia&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:textSize=&quot;14sp&quot;<br>         android:gravity=&quot;center_vertical&quot;<br>         android:textColor=&quot;@color/warm_grey&quot;/&gt;<br> <br>     &lt;androidx.recyclerview.widget.RecyclerView<br>         android:id=&quot;@+id/directionStepsRecyclerView&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;/&gt;<br> <br> &lt;/LinearLayout&gt;</pre><p>As a note, we can get more than one direction route and paths from Directions API. In this tutorial, we use the first one. Let’s continue with the setting total duration, total distance and first step roadname.</p><pre>val mainInfo = directionsResponse.routes[0].paths[0].durationText + &quot; &quot; + <br>                    directionsResponse.routes[0].paths[0].distanceText<br>directionStepsMainInfo.<em>text </em>= mainInfo<br>directionStepsVia.<em>text </em>= directionsResponse.routes[0].paths[0].steps[0].roadName</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCWzVOl7e1gYT04luMMMiA.jpeg" /></figure><p>We need RecyclerView to show steps detail. Let’s define a layout for item view. “<em>direction_view_holder</em>”</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br> &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>     android:orientation=&quot;vertical&quot;<br>     android:layout_width=&quot;match_parent&quot;<br>     android:layout_height=&quot;wrap_content&quot;<br>     android:background=&quot;@android:color/white&quot;<br>     android:padding=&quot;16dp&quot;&gt;<br> <br>     &lt;LinearLayout<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:orientation=&quot;horizontal&quot;&gt;<br> <br>         &lt;ImageView<br>             android:id=&quot;@+id/actionImage&quot;<br>             android:layout_width=&quot;50dp&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:layout_gravity=&quot;center_vertical&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/actionDescription&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textColor=&quot;@color/colorPrimaryDark&quot;<br>             android:textSize=&quot;16sp&quot;<br>             android:layout_gravity=&quot;center_vertical&quot;/&gt;<br> <br>     &lt;/LinearLayout&gt;<br> <br>     &lt;TextView<br>         android:id=&quot;@+id/actionDistanceTime&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:textColor=&quot;@color/warm_grey&quot;<br>         android:textSize=&quot;16sp&quot;<br>         android:layout_marginTop=&quot;10dp&quot;<br>         android:layout_marginStart=&quot;50dp&quot;/&gt;<br> <br> &lt;/LinearLayout&gt;</pre><p>And, let’s define the RecyclerView Adaper methods.</p><pre>override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DirectionsHolder {<br>     val inflater = LayoutInflater.from(parent.<em>context</em>)<br>     val view: View = inflater.inflate(R.layout.<em>direction_view_holder</em>, parent, false)<br>     return DirectionsHolder(view)<br> }</pre><pre>override fun onBindViewHolder(holder: DirectionsHolder, position: Int) {<br>     val step: Steps? = steps[position]<br>     if (step != null) {<br>         holder.actionDescription.<em>text </em>= step.instruction<br>         holder.actionDistanceTime.<em>text </em>= context.getString(R.string.<em>distance_time</em>,<br>                step.distanceText,step.durationText)<br>         when(step.action){<br>             DirectionActionType.STRAIGHT.type-&gt; holder.actionImage.setImageDrawable(<br>                    context.<em>resources</em>.getDrawable(R.drawable.<em>ic_go</em>,null))<br>             …<br>         }<br>     }<br> }</pre><p>As you can see, we can see step instruction, duration and time. Also, we can set actions image as we want. Here is the DirectionActionTypes:</p><pre>enum class DirectionActionType(val type: String) {<br>     STRAIGHT(&quot;straight&quot;),<br>     TURN_LEFT(&quot;turn-left&quot;),<br>     TURN_RIGHT(&quot;turn-right&quot;),<br>     TURN_SLIGHT_LEFT(&quot;turn-slight-left&quot;),<br>     TURN_SLIGHT_RIGHT(&quot;turn-slight-right&quot;),<br>     TURN_SHARP_LEFT(&quot;turn-sharp-left&quot;),<br>     TURN_SHARP_RIGHT(&quot;turn-sharp-right&quot;),<br>     UTURN_LEFT(&quot;uturn-left&quot;),<br>     UTURN_RIGHT(&quot;uturn-right&quot;),<br>     RAMP_LEFT(&quot;ramp-left&quot;),<br>     RAMP_RIGHT(&quot;ramp-right&quot;),<br>     MERGE(&quot;merge&quot;),<br>     FORK_LEFT(&quot;fork-left&quot;),<br>     FORK_RIGHT(&quot;fork-right&quot;),<br>     FERRY (&quot;ferry&quot;),<br>     FERRY_TRAIN (&quot;ferry-train&quot;),<br>     ROUNDABOUT_LEFT(&quot;roundabout-left&quot;),<br>     ROUNDABOUT_RIGHT(&quot;roundabout-right&quot;),<br>     END(&quot;end&quot;),<br>     UNKOWN(&quot;unknown&quot;)<br> }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WT00g9Qhrp21btBU1SxGYg.jpeg" /></figure><p>Last thing, that we need to add :</p><pre>val directionAdapter = DirectionsAdapter(this,directionsResponse.routes[0].paths[0].steps)<br>directionStepsRecyclerView.<em>adapter </em>= directionAdapter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Qe5dj3qb-F1H3ucJh05Hw.jpeg" /></figure><p>If you have any comments or questions, please let me know</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8593857e18a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-draw-a-route-and-show-route-steps-with-hms-direction-api-8593857e18a7">How to draw a route and show route steps with HMS Direction API</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Customize Marker Information Window]]></title>
            <link>https://medium.com/huawei-developers/how-to-customize-marker-information-window-60b497ffdb83?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/60b497ffdb83</guid>
            <category><![CDATA[mapkit]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 12:21:56 GMT</pubDate>
            <atom:updated>2020-03-31T11:57:38.100Z</atom:updated>
            <content:encoded><![CDATA[<h3>Customize Map Marker Information Window with Huawei — HMS Map Kit</h3><p>Hi everyone,</p><p>At this tutorial, I will guide you how to customize marker information window on map using HMS Map Kit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_JVcoPdULDGMUxqOh_vD8g.jpeg" /></figure><p>To integrate HMS Map Kit, please follow <a href="https://developer.huawei.com/consumer/en/codelab/HMSMapKit/index.html#0">this instruction</a> or you can check <a href="https://medium.com/@mine1810/how-to-integrate-hms-map-kit-add-marker-and-draw-circle-176df7f0de8f">this tutorial</a>.</p><p>After initializing map, we need to create custom view for information window. Let’s save this layout as <strong><em>custom_info_window</em></strong>.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br> &lt;androidx.cardview.widget.CardView<br>     xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>     xmlns:card_view=&quot;http://schemas.android.com/apk/res-auto&quot;<br>     android:layout_width=&quot;wrap_content&quot;<br>     android:layout_height=&quot;wrap_content&quot;<br>     card_view:cardCornerRadius=&quot;10dp&quot;<br>     card_view:cardElevation=&quot;10dp&quot;<br>     card_view:cardBackgroundColor=&quot;@color/grey_87&quot;&gt;<br> <br>     &lt;LinearLayout<br>         android:layout_width=&quot;wrap_content&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:orientation=&quot;vertical&quot;<br>         android:padding=&quot;10dp&quot;&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/infoTile&quot;<br>             android:layout_width=&quot;wrap_content&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:ellipsize=&quot;end&quot;<br>             android:singleLine=&quot;true&quot;<br>             android:textColor=&quot;@android:color/black&quot;<br>             android:textSize=&quot;16sp&quot;<br>             android:textStyle=&quot;bold&quot;<br>             android:gravity=&quot;center_vertical&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/infoAddress&quot;<br>             android:layout_width=&quot;wrap_content&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textColor=&quot;@android:color/black&quot;<br>             android:textSize=&quot;14sp&quot;<br>             android:gravity=&quot;center_vertical&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/infoGetDirections&quot;<br>             android:layout_width=&quot;wrap_content&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textColor=&quot;@color/cardinal&quot;<br>             android:textSize=&quot;14sp&quot;<br>             android:text=&quot;@string/get_direction&quot;<br>             android:drawableEnd=&quot;@drawable/ic_directions_cardinal_24dp&quot;<br>             android:drawablePadding=&quot;10dp&quot;<br>             android:gravity=&quot;center_vertical&quot;/&gt;<br> <br>     &lt;/LinearLayout&gt;<br> <br> &lt;/androidx.cardview.widget.CardView&gt;</pre><p>Second step, we need to create data class to show marker information. <strong><em>InfoWindowData</em></strong></p><pre>data class InfoWindowData(val siteId: String,<br>                          val siteName: String,<br>                          val siteAddress: String,<br>                          val siteLat: Double,<br>                          val siteLng: Double)</pre><p>Next step, we need an adapter to integrate information view. So, let’s create <strong><em>CustomInfoWindowAdapter</em></strong> that is implemented from <em>HMS Map Kit InfoWindowAdapter</em>. At <em>getInfoWindow </em>method, first, we need to inflate the layout we created above. Than, need to get data information from marker tag( I will explain below how to add data information to the marker)</p><pre>internal class CustomInfoWindowAdapter(val context: Context) : InfoWindowAdapter {<br> <br>     override fun getInfoWindow(marker: Marker?): View {<br> <br>         val mInfoView = (context as Activity).<br><em>            layoutInflater</em>.inflate(R.layout.<em>custom_info_window</em>, null)<br>         val mInfoWindow: InfoWindowData? = marker?.<em>tag </em>as InfoWindowData?<br> <br>         mInfoView.infoTile.<em>text </em>= mInfoWindow?.siteName<br>         mInfoView.infoAddress.<em>text </em>= mInfoWindow?.siteAddress<br> <br>         return mInfoView<br>     }<br> <br>     override fun getInfoContents(marker: Marker): View? {<br>         return null<br>     }<br> }</pre><p>At final part, we need to add marker and information window to the map. Let’s set InfoWindowData object.</p><pre>val info = InfoWindowData(<strong>site</strong>.<em>siteId</em>,<br>     <strong>site</strong>.<em>name</em>,<br>     <strong>site</strong>.<em>formatAddress</em>,<br>     <strong>site</strong>.<em>location</em>.<em>lat</em>,<br>     <strong>site</strong>.<em>location</em>.<em>lng<br> </em>)</pre><p>As a note, in this tutorial, I got site information from HMS Site Kit, you can check Site Kit Tutorial from <a href="https://medium.com/@mine1810/how-to-get-places-with-using-hms-site-kit-562245b6c10e">here</a>.</p><pre>public class Site {<br>     private String siteId;<br>     private String name;<br>     private String formatAddress;<br>     private AddressDetail address;<br>     private Coordinate location;<br>     private CoordinateBounds viewport;<br>     private double distance;<br>     private Poi poi;<br>}</pre><p>After set the information, we need to set up MarkerOptions. For more marker options, please <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/hms-map-v4-drawonthemap#h2-1578465367192">check</a>.</p><pre>val options = MarkerOptions()<br> options.position(LatLng(<strong>site</strong>.<em>location</em>.<em>lat</em>, <strong>site</strong>.<em>location</em>.<em>lng</em>))<br> options.title(<strong>site</strong>.<em>name</em>)<br> options.draggable(false)<br> options.icon(BitmapDescriptorFactory.fromResource(R.drawable.<em>ic_movie_filter_red_900_24dp</em>))<br> options.clusterable(false)</pre><p>Next, we need to set and add adapter that we created above on map.</p><pre>val customInfoWindow = <em>context</em>?.<em>let </em><strong>{ </strong>ctx <strong>-&gt; </strong>CustomInfoWindowAdapter(ctx) <strong>}<br> </strong>hMap.setInfoWindowAdapter(customInfoWindow)</pre><pre>val marker = hMap.addMarker(options)<br> marker.<em>tag </em>= info</pre><p>You can see all methods at below for final part.</p><pre>override fun onMapReady(map: HuaweiMap) {<br>     hMap = map<br>     hMap.setOnMarkerClickListener <strong>{ </strong>marker <strong>-&gt;<br>         </strong>val isInfoWindowShown: Boolean = marker.<em>isInfoWindowShown<br>         </em>when {<br>             isInfoWindowShown -&gt; {<br>                 marker.hideInfoWindow()<br>             }<br>             else -&gt; {<br>                 marker.showInfoWindow()<br>             }<br>         }<br>         true<br>     <strong>}<br>     </strong>setMarkersToMap(placeList)<br> }</pre><pre>private fun setMarkersToMap(placeList : List&lt;Site&gt;){<br>     placeList.<em>forEach </em><strong>{ it-&gt;<br>         </strong>val latlng = LatLng(<strong>it</strong>.<em>location</em>.<em>lat</em>, <strong>it</strong>.<em>location</em>.<em>lng</em>)<br>         val info = InfoWindowData(<strong>it</strong>.<em>siteId</em>,<br>             <strong>it</strong>.<em>name</em>,<br>             <strong>it</strong>.<em>formatAddress</em>,<br>             <strong>it</strong>.<em>location</em>.<em>lat</em>,<br>             <strong>it</strong>.<em>location</em>.<em>lng</em> <br>         )<br>         val options = MarkerOptions()<br>         options.position(latlng)<br>         options.title(<strong>it</strong>.<em>name</em>)<br>         options.draggable(false)<br>  options.icon(BitmapDescriptorFactory.fromResource(R.drawable.<em>ic_movie_filter_red_900_24dp</em>))<br>         options.clusterable(false)<br> <br>         val customInfoWindow = <em>context</em>?.<em>let </em><strong>{ </strong>ctx <strong>-&gt; </strong>CustomInfoWindowAdapter(ctx) <strong>}<br>         </strong>hMap.setInfoWindowAdapter(customInfoWindow)<br>         val marker = hMap.addMarker(options)<br>         marker.<em>tag </em>= info<br>     <strong>}<br> </strong>}</pre><p>I hope you found this tutorial helpful and if you have any comments or questions, please let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60b497ffdb83" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-customize-marker-information-window-60b497ffdb83">How To Customize Marker Information Window</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate HMS Map Kit, add marker and draw circle]]></title>
            <link>https://medium.com/huawei-developers/how-to-integrate-hms-map-kit-add-marker-and-draw-circle-176df7f0de8f?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/176df7f0de8f</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[mapkit]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[hms]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 12:11:23 GMT</pubDate>
            <atom:updated>2022-08-15T12:14:02.256Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to integrate Huawei — HMS Map Kit, add a marker and draw a circle</h3><p>Hi everyone,</p><p>In this tutorial, I will guide you on how to integrate HMS Map Kit into the project. And, we will add a marker and draw a circle on the map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4DRBu_7ZTEZbMB-Ccghyg.jpeg" /></figure><p>Before the integration, we need to configure app information in AppGallery Connect. Please check <a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-config-agc-0000001061560289">these instructions</a> to configure.</p><p>After the app configuration, let’s add to <strong>the root directory build.gradle</strong></p><p>— repositories to configure the Maven repository address for the HMS SDK</p><p>— dependencies to add agcp configurations</p><pre>buildscript {<br>     repositories {<br>        maven { url &#39;https://developer.huawei.com/repo/&#39; }<br>    }<br>    dependencies {<br>        classpath &#39;com.huawei.agconnect:agcp:1.6.0.300&#39;<br>    }<br>}<br><br>allprojects {<br>    repositories {<br>        maven {url &#39;https://developer.huawei.com/repo/&#39;}<br>    }<br>}</pre><p><strong>At the app directory build.gradle</strong>,</p><p>— configure build dependencies.</p><pre>dependencies {<br>     implementation &#39;com.huawei.hms:maps:6.6.0.300&#39;<br>}</pre><p>— And apply for plugin</p><pre>apply plugin: &#39;com.huawei.agconnect&#39;</pre><p>Now, HMS Map Kit is ready to go. Before coding, we need to add permissions to the <em>AndroidManifest.xml</em></p><pre>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;<br> &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;</pre><p>Let’s define our layout as follows:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br> &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>     xmlns:map=&quot;http://schemas.android.com/apk/res-auto&quot;<br>     android:layout_width=&quot;match_parent&quot;<br>     android:layout_height=&quot;match_parent&quot;&gt;<br> <br>     &lt;com.huawei.hms.maps.MapView<br>         android:id=&quot;@+id/mapView&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;match_parent&quot;<br>         map:mapType=&quot;normal&quot;<br>         map:uiCompass=&quot;true&quot;<br>         map:uiZoomControls=&quot;true&quot;<br>         map:cameraZoom=&quot;8.5&quot;/&gt;<br> <br> &lt;/LinearLayout&gt;</pre><p>We can save this layout as <em>fragment_map</em>.</p><p>Now we can define our fragment. We need to implement <strong><em>OnMapReadyCallback</em></strong> to our fragment and call <strong><em>getMapAsync()</em></strong> to register the map callback.</p><pre>val MAPVIEW_BUNDLE_KEY = &quot;MapViewBundleKey&quot;</pre><pre>class MapFragment : Fragment(), OnMapReadyCallback{<br> <br>     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, <br>                                savedInstanceState: Bundle?): View? {<br>         val root = inflater.inflate(R.layout.<em>fragment_map</em>, container, false)<br>         mapView = root.findViewById(R.id.<em>mapView</em>)<br>         var mapViewBundle: Bundle? = null<br>         if (savedInstanceState != null) {<br>             mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY)<br>         }<br>         mapView.onCreate(mapViewBundle)<br>         mapView.getMapAsync(this)<br> <br>         return root<br>     }</pre><p>Next step, we need to call the <strong><em>onMapReady</em></strong> callback to obtain the HuaweiMap object.</p><pre>override fun onMapReady(map: HuaweiMap) {<br>     map.<em>isMyLocationEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isMyLocationButtonEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isCompassEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isRotateGesturesEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isScrollGesturesEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isScrollGesturesEnabledDuringRotateOrZoom </em>= true<br>     map.<em>uiSettings</em>.<em>isTiltGesturesEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isZoomControlsEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isIndoorLevelPickerEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isMapToolbarEnabled </em>= true<br>     map.<em>uiSettings</em>.<em>isZoomGesturesEnabled </em>= false<br>     map.<em>uiSettings</em>.setAllGesturesEnabled(true)<br> <br>     map.setOnMapLoadedCallback <strong>{<br>         </strong>Log.d(Constants().LOG_TAG_MAP, &quot;[Map] Loaded.&quot;)<br>     <strong>}<br>     </strong>hMap = map<br> }</pre><p>As you can see, we can change map UI settings as we want. Here, we are ready to display the map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGuF3ZpWGSV9Or517sCv-w.jpeg" /></figure><h3>Add Circle</h3><p>Now, let’s add the circle to the map. We need to define the circle center point (note* I use my current location latitude and longitude) and circle radius (circle radius must be a meter value). Also, we can define circle <strong><em>strokeWidth</em></strong> and <strong><em>strokeColor</em></strong> as wanted. For more information, please <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/hms-map-v4-drawonthemap#h2-1576633792035">check</a></p><pre>private var circle: Circle? = null<br> private fun addCircle() {<br>     circle?.remove()<br>     circle = hMap<br>         .addCircle(CircleOptions().center(LatLng(40.9702, 29.0706))<br>         .radius(2000.0))<br>     circle?.<em>strokeWidth </em>= 5f<br>     circle?.<em>strokeColor </em>= Color.<em>RED<br> </em>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_8c-_gFCq15PiyNwWxzMTg.jpeg" /></figure><h3>Add Marker</h3><p>Next step, we will add markers to the map. We can define the marker’s position, title, and snippet. Also, we can use custom images to replace default icons or modify marker attributes to change the marker icons like the following.</p><pre>private fun addMarker(){<br>     hMap.addMarker(<br>         MarkerOptions()<br>             .title(&quot;Cinemaximum&quot;)<br>             .snippet(&quot;Cinema&quot;)<br>             .position(LatLng(40.9675909, 29.06499))<br>             .icon(BitmapDescriptorFactory.fromResource(R.drawable.<em>ic_movie_filter_red_900_24dp</em>)) <br>     )<br> }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-eKe6HgksBb_-hkWvMx7A.jpeg" /></figure><p>If you want to customize the marker info view, please check <a href="https://medium.com/@mine1810/how-to-customize-marker-information-window-60b497ffdb83">this tutorial</a>.</p><p>In this tutorial, I try to explain how we integrate the HMS Map and add a marker and circle. I hope you found this tutorial helpful and if you have any comments or questions, please let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=176df7f0de8f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-integrate-hms-map-kit-add-marker-and-draw-circle-176df7f0de8f">How to integrate HMS Map Kit, add marker and draw circle</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Get Places with Using HMS Site Kit]]></title>
            <link>https://medium.com/huawei-developers/how-to-get-places-with-using-hms-site-kit-562245b6c10e?source=rss-936bf0710fc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/562245b6c10e</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[site-kit]]></category>
            <category><![CDATA[hms]]></category>
            <dc:creator><![CDATA[Mine KULAÇ AKKULAK]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 11:51:27 GMT</pubDate>
            <atom:updated>2020-03-31T12:00:50.213Z</atom:updated>
            <content:encoded><![CDATA[<h3>Get Places with using Huawei — HMS Site Kit</h3><p>Hi everyone,</p><p>In this tutorial, I will guide you how to get nearby cinema places and text search a place with using HMS Site Kit. And, we will show them on RecyclerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBAbCUGBMJTC5cKc0P4nmA.jpeg" /></figure><p>Before the coding, let’s integrate the Site Kit and Location Kit to the project with these instructions; <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/hms-site-integratinghmssdk">Site Kit</a>, <a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/location-preparation">Location Kit.</a></p><h3>Site Kit Nearby Search</h3><p>To get nearby places, we need to know current location. So, we will get the location information with using HMS Location Kit.</p><pre>private fun getLocation(){<br> <br> fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this)<br> <br>     val mLocationCallback: LocationCallback = object : LocationCallback(){<br>         override fun onLocationResult(locationResult: LocationResult) {<br>             currentLatitude = locationResult.<em>lastLocation</em>.<em>latitude</em><br>             currentLongitude = locationResult.<em>lastLocation</em>.<em>longitude</em><br>         }<br>     }<br> <br>     val mLocationRequest = LocationRequest()<br>     mLocationRequest.<em>interval </em>= 1800000  // change the interval as needed<br>     mLocationRequest.<em>priority </em>= LocationRequest.<em>PRIORITY_HIGH_ACCURACY<br> <br>     </em>fusedLocationProviderClient.requestLocationUpdates(mLocationRequest,mLocationCallback, <br>            Looper.getMainLooper()).addOnSuccessListener<strong>{}</strong>.addOnFailureListener<strong>{}<br> <br> </strong>}</pre><p>Now, we know our current location. Let’s try to get nearby cinema places. Site Kit has <strong><em>NearbySearchRequest</em></strong> class. We need to use this request class. Related parameters are as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*Wweljkdg_otBIGnOLqVb-g.png" /></figure><pre>public class NearbySearchRequest {<br>     private Integer pageSize;<br>     private Integer pageIndex;<br>     private String query;<br>     private Coordinate location;<br>     private Integer radius;<br>     private LocationType poiType;<br>     private String language;<br>}</pre><p>At this tutorial, we will use these parameters: <em>LocationType.MOVIE_THEATER</em> as <strong>poiTypes</strong>, <strong>location</strong>, <strong>radius</strong> and <strong>pageIndex</strong>.</p><p>First, let’s create a request object with parameters. we will request for cinemas which are closest to our location, within 6000m.</p><pre>val request = NearbySearchRequest()<br> request.<em>poiType </em>= LocationType.MOVIE_THEATER<br> request.<em>location </em>= Coordinate(currentLatitude, currentLongitude)<br> request.<em>radius </em>= 6000   // meter<br> request.<em>pageIndex </em>= 1</pre><p>For Api connection, Site Kit has <strong><em>SearchService</em></strong> interface. To get nearby places, we need to use <strong><em>nearbySearch(NearbySearchRequest request,</em></strong></p><p><strong><em>SearchResultListener&lt;NearbySearchResponse&gt; listener) </em></strong>method with adding request object and result listener.</p><pre>lateinit var siteCinemaList: List&lt;Site&gt;</pre><pre>val searchService = SearchServiceFactory.create(context)<br> searchService.nearbySearch(request, object : SearchResultListener&lt;NearbySearchResponse&gt;{<br>     override fun onSearchError(status: SearchStatus?) {<br>         Log.e(&quot;onSearchError&quot;, status.<em>errorMessage</em>)<br>     }<br> <br>     override fun onSearchResult(response: NearbySearchResponse?) {<br>         response?.<em>let </em><strong>{<br>             </strong><em>siteCinemaList</em> = <strong>it</strong>.<em>sites<br>             </em>setCinemaRecyclerView(siteCinemaList)<br>         <strong>}<br>     </strong>}<br> })</pre><p><em>NearbySearchResponse </em>data structure:</p><pre>public class NearbySearchResponse {<br>     private List&lt;Site&gt; sites;<br>     private int totalCount;<br>}</pre><pre>public class Site {<br>     private String siteId;<br>     private String name;<br>     private String formatAddress;<br>     private AddressDetail address;<br>     private Coordinate location;<br>     private CoordinateBounds viewport;<br>     private double distance;<br>     private Poi poi;<br>}</pre><p>From <em>onSearchResult</em> method, we got the cinemas closest to our location within 6000 m. Now, we are ready to show cinemas at RecyclerView.</p><p>Let’s create item layout; <strong><em>place_cinema_view_holder</em></strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br> &lt;androidx.cardview.widget.CardView<br>     xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>     xmlns:card_view=&quot;http://schemas.android.com/apk/res-auto&quot;<br>     android:layout_width=&quot;match_parent&quot;<br>     android:layout_height=&quot;wrap_content&quot;<br>     android:layout_margin=&quot;16dp&quot;<br>     card_view:cardCornerRadius=&quot;10dp&quot;<br>     card_view:cardElevation=&quot;10dp&quot;<br>     card_view:cardBackgroundColor=&quot;@color/colorPrimary&quot;&gt;<br> <br>     &lt;LinearLayout<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:orientation=&quot;vertical&quot;<br>         android:padding=&quot;10dp&quot;&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaName&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;18sp&quot;<br>             android:textColor=&quot;@android:color/white&quot;<br>             android:textStyle=&quot;italic&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaAddress&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;15sp&quot;<br>             android:textColor=&quot;@color/white_90&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaDistance&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;15sp&quot;<br>             android:textColor=&quot;@color/forest_green&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaOpeningHour&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;15sp&quot;<br>             android:textColor=&quot;@color/white_90&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaPhoneNumber&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;15sp&quot;<br>             android:textColor=&quot;@color/white_90&quot;/&gt;<br> <br>         &lt;TextView<br>             android:id=&quot;@+id/cinemaWebsiteUrl&quot;<br>             android:layout_width=&quot;match_parent&quot;<br>             android:layout_height=&quot;wrap_content&quot;<br>             android:textSize=&quot;15sp&quot;<br>             android:textColor=&quot;@color/white_90&quot;/&gt;<br> <br>     &lt;/LinearLayout&gt;<br> <br> &lt;/androidx.cardview.widget.CardView&gt;</pre><p>Let’s create ViewHolder related with our layout</p><pre>class CinemaViewHolder(view: View) : RecyclerView.ViewHolder(view) {<br>     val cinemaName: TextView = view.findViewById(R.id.<em>cinemaName</em>)<br>     val cinemaAddress: TextView = view.findViewById(R.id.<em>cinemaAddress</em>)<br>     val cinemaDistance: TextView = view.findViewById(R.id.<em>cinemaDistance</em>)<br>     val cinemaOpeningHour: TextView = view.findViewById(R.id.<em>cinemaOpeningHour</em>)<br>     val cinemaPhoneNumber: TextView = view.findViewById(R.id.<em>cinemaPhoneNumber</em>)<br>     val cinemaWebsiteUrl: TextView = view.findViewById(R.id.<em>cinemaWebsiteUrl</em>)<br> }</pre><p>At <em>RecyclerView </em>Adapter, we need to inflate layout we created above at <em>onCreateViewHolder</em></p><pre>override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {<br>     val inflater = LayoutInflater.from(parent.<em>context</em>)<br>     val view: View = inflater.inflate(R.layout.<em>place_cinema_view_holder</em>, parent, false)<br>     return PlaceCinemaViewHolder(view)<br> }</pre><p>Let’s set the cinema information (<strong>we get from Site Kit NearbySearch</strong>) to the holder item at <em>onBindViewHolder</em></p><pre>override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {<br>     val cinemaViewHolder = holder as CinemaViewHolder<br>     val cinema: Site? = getItem(position)<br>     if(cinema!=null){<br>         cinemaViewHolder.cinemaName.<em>text </em>= cinema.<em>name<br>         </em>cinemaViewHolder.cinemaAddress.<em>text </em>= cinema.<em>formatAddress<br>         </em>cinemaViewHolder.cinemaDistance.<em>text </em>= <br>                calculateDistanceFromLocation(cinema.<em>location</em>.<em>lat</em>,cinema.<em>location</em>.<em>lng</em>)<br>         cinemaViewHolder.placeOpeningHour.<em>text </em>= <br>                context.getString(R.string.<em>place_opening_hour</em>,cinema.<em>poi</em>.<em>openingHours</em>.<em>texts</em>[0])<br>         cinemaViewHolder.placePhoneNumber.<em>text </em>= <br>                context.getString(R.string.<em>place_phone_number</em>,cinema.<em>poi</em>.<em>phone</em>)<br>         cinemaViewHolder.placeWebsiteUrl.<em>text </em>= <br>                context.getString(R.string.<em>place_website</em>,cinema.<em>poi</em>.<em>websiteUrl</em>)<br>     }<br> }</pre><pre>&lt;string name=&quot;place_opening_hour&quot;&gt;Hour : %s&lt;/string&gt;<br> &lt;string name=&quot;place_phone_number&quot;&gt;Phone : %s&lt;/string&gt;<br> &lt;string name=&quot;place_website&quot;&gt;Website : %s&lt;/string&gt;<br> &lt;string name=&quot;distance_km&quot;&gt;km&lt;/string&gt;</pre><p>To show distance between current and cinema location, we can use this helper method:</p><pre>private fun calculateDistanceFromLocation(pLatitude : Double, pLongitude : Double) : String{<br>     val locationA = Location(&quot;point A&quot;)<br> <br>     locationA.<em>latitude </em>= latitude<br>     locationA.<em>longitude </em>= longitude<br> <br>     val locationB = Location(&quot;point B&quot;)<br> <br>     locationB.<em>latitude </em>= pLatitude<br>     locationB.<em>longitude </em>= pLongitude<br> <br>     val distance: Float = locationA.distanceTo(locationB)<br>     return formatDistance(distance.toInt())<br> }<br> <br> private fun formatDistance(distance : Int?) =<br>     when {<br>         distance!! &gt; 1000 -&gt; String.<em>format</em>(&quot;%.1f&quot;, distance / 1000.0) + &quot; &quot; + <br>            context.getString(R.string.<em>distance_km</em>)<br>         else -&gt; &quot;$distance &quot; + context.getString(R.string.<em>distance_m</em>)<br>     }</pre><p>Finally, we need to set the RecyclerView at our activity or fragment</p><pre>fun setCinemaRecyclerView(){<br>     cinemaAdapter = CinemaAdapter(siteCinemaList)<br>     cinemaRecyclerView.<em>adapter </em>= placeCinemaAdapter<br> }</pre><h3>Site Kit Text Search</h3><p>Above, we tried to get nearby cinemas. Now we will try to get cinema list from a ”<strong>query text</strong>”.</p><p>To search with a text, Site Kit has <strong><em>TextSearchRequest </em></strong>class. We need to use this request class. Related parameters are as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*KE5g8mGTDVMl8A7EcuwTwQ.png" /></figure><pre>public class TextSearchRequest {<br>     private String language;<br>     private String query;<br>     private Coordinate location;<br>     private Integer radius;<br>     private CoordinateBounds bounds;<br>     private Integer pageSize;<br>     private LocationType poiType;<br>     private Integer pageIndex;<br>     private String countryCode;<br>}</pre><p>Now, we will use these parameters: <em>LocationType.MOVIE_THEATER</em> as <strong>poiTypes</strong>, <strong>location</strong>, <strong>radius</strong>, <strong>pageIndex, pagesize and query.</strong></p><p>Let’s create a request object with parameters.</p><pre>val request = TextSearchRequest()<br> request.<em>query </em>= “Cinemaximum”<br> request.<em>poiType </em>= LocationType.MOVIE_THEATER<br> request.<em>location </em>= Coordinate(currentLatitude, currentLongitude)<br> request.<em>radius </em>= 10000  //meter<br> request.<em>pageIndex </em>= 1<br> request.<em>pageSize </em>= 20</pre><p>With this request, we will try to get cinemas with the name “Cinemaximum” between our location and 10000 m.</p><p>With <strong><em>SearchService</em></strong> interface (I explained above), now we need to use</p><p><strong><em>textSearch (TextSearchRequest request, SearchResultListener&lt;TextSearchResponse&gt; listener) </em></strong>method with adding request object and result listener.</p><pre>searchService.textSearch(request, object :SearchResultListener&lt;TextSearchResponse&gt;{<br>     override fun onSearchError(status: SearchStatus?) {<br>         Log.e(&quot;onSearchError&quot;, status.<em>errorMessage</em>)<br>     }<br> <br>     override fun onSearchResult(response: TextSearchResponse?) {<br>         response?.<em>let </em><strong>{<br>             </strong><em>siteCinemaList</em> = <strong>it</strong>.<em>sites<br>             </em>setCinemaRecyclerView(siteCinemaList)<br>         <strong>}<br>     </strong>}<br> })</pre><p><em>TextSearchResponse </em>data structure:</p><pre>public class TextSearchResponse {<br>     private int totalCount;<br>     private List&lt;Site&gt; sites;<br>}</pre><pre>public class Site {<br>     private String siteId;<br>     private String name;<br>     private String formatAddress;<br>     private AddressDetail address;<br>     private Coordinate location;<br>     private CoordinateBounds viewport;<br>     private double distance;<br>     private Poi poi;<br>}</pre><p>From <em>onSearchResult</em> method, we got the cinemas with the name “Cinemaximum” between our location and 10000 m. Now, we are ready to show cinemas at RecyclerView. You can follow instruction I explained above to show the cinemas at RecyclerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A9a3ioHUEVXphdMiFYZFOg.jpeg" /></figure><p>I hope, you found this tutorial helpful and if you have any comments or questions, please let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=562245b6c10e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-get-places-with-using-hms-site-kit-562245b6c10e">How To Get Places with Using HMS Site Kit</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>