<?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 Damla Yagmur on Medium]]></title>
        <description><![CDATA[Stories by Damla Yagmur on Medium]]></description>
        <link>https://medium.com/@damlayagmur?source=rss-8336030b1cad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6ygbuk3ozeV_yaoJpgWaXQ.jpeg</url>
            <title>Stories by Damla Yagmur on Medium</title>
            <link>https://medium.com/@damlayagmur?source=rss-8336030b1cad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:49:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@damlayagmur/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[WebRTC Usage with Firestore — Kotlin]]></title>
            <link>https://medium.com/@damlayagmur/webrtc-usage-with-firestore-kotlin-4fd7d6c1652b?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fd7d6c1652b</guid>
            <category><![CDATA[firestore]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[videoconference]]></category>
            <category><![CDATA[webrtc]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Sun, 07 May 2023 11:22:16 GMT</pubDate>
            <atom:updated>2023-05-07T11:22:16.439Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Usage with Firestore — Kotlin</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*PDkRTCtsm6zLz1BANgbSaA.png" /><figcaption>WebRTC(<strong><em>R</em></strong><em>eal — </em><strong><em>T</em></strong><em>ime — </em><strong><em>C</em></strong><em>ommunication</em>)</figcaption></figure><h4><strong>Introduction</strong></h4><p>Hi folks,</p><p>In this article, we will talk about WebRTC Usage with Firestore — Kotlin. As we all know, video call applications have been used a lot because of pandemic and we decided to develop a Video Call App using WebRTC, as a challenge.</p><p><strong>What is WebRTC?</strong></p><p>WebRTC(<strong><em>R</em></strong><em>eal - </em><strong><em>T</em></strong><em>ime - </em><strong><em>C</em></strong><em>ommunication</em>) basically provides real-time voice, video communication and data sharing as peer-to-peer using a web browsers. WebRTC has many advantages but the most important advantage is it is already embedded in browsers and users can run WebRTC applications directly in their browsers without installing any extra plugins. You can check <a href="https://en.wikipedia.org/wiki/WebRTC">WebRTC page in Wikipedia</a> for details of supported browsers.</p><p>For example, you are going to attend a meeting and you receive the meeting link and the relevant app is not installed on your device, but you can join the meeting via browser without installing the app. A WebRTC supported browser will ask you for permission to use your camera and microphone, when you give these permissions, your camera and microphone will be recognized by the site and you will be able to provide video and audio communication.</p><p><strong>How does WebRTC work?</strong></p><p>We can send messages directly between the two browsers without the servers with WebRTC. Because of this, WebRTC is belongs to peer-to-peer technology(P2P). Shortly, browsers can communicate directly.</p><p>In order to understand the WebRTC working logic in more detail, there are some terms that we need to know first. These are <strong><em>SDP, NAT, STUN, TURN, ICE, Peer Connection, ICE Canditate, ICE Canditate, Offer SDP and Answer SDP.</em></strong></p><p><strong>ICE- TURN-STUN-NAT-SDP-PeerConnection-ICECandidate, Offer SDP, AnswerSDP</strong></p><ul><li><strong>SDP</strong> — Session Description Protocol</li><li><strong>NAT</strong> — Network Address Translation</li><li><strong>STUN</strong> — Session Traversal Utilities for NAT</li><li><strong>TURN<em> </em></strong><em>— </em>Traversal Using Relays around NAT</li><li><strong>ICE </strong>— Interactive Connectivity Establishment</li><li><strong>Peer Connection </strong>— that enables direct communication between two browsers.</li><li><strong>ICE Canditate </strong>— exchanging media between browsers using network addresses.</li><li><strong>Offer SDP </strong>— WebRTC message for connection setup</li><li><strong>Answer SDP</strong> — WebRTC message that responds to “Offer SDP” and helps establish a peer-to-peer connection.</li></ul><p><strong>Integrating WebRTC for Android Project</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd93e846a3736817c22602a334600b77/href">https://medium.com/media/dd93e846a3736817c22602a334600b77/href</a></iframe><p><strong>Firestore:</strong> It is basically a cloud-hosted NoSQL database to store and synchronize data. Firestore has a flexible structure. Data is stored in structures called <strong><em>Documents</em></strong>. The Document collection is called <strong><em>Collections</em></strong>. Please take a good look at these terms because we will use them a lot throughout the article :) <a href="https://firebase.google.com/docs/firestore/data-model">Firestore Data Model Official Document</a></p><p><strong>Firebase Integration for Firestore</strong></p><p>First you need to go to <a href="https://console.firebase.google.com/">Firebase Console</a> and add a project. And then you need to set up your development environment. Please check details with using <a href="https://firebase.google.com/docs/firestore/quickstart">official document</a>. If you have any questions related with this step, please leave a comment.</p><p>Firstly, by entering the project we have created, we click on Cloud Firestore on the left and click Create database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YD4d6zZuOw58RC6pBAZbsw.png" /></figure><p>We are not doing a project to be published so we will start it in test mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWaLbgb8t_MfYfnOLyK1Nw.png" /></figure><p>And then add Firestore implementation in build.gradle(app). We are using Kotlin so please implement <strong><em>firestore-ktx</em></strong> as above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b83882edcac583a4c47f83cc9113c4e5/href">https://medium.com/media/b83882edcac583a4c47f83cc9113c4e5/href</a></iframe><h4><strong>How is SDP Signaling Processed with Firestore?</strong></h4><p><strong>1- Create Offer SDP — Forward Offer SDP to server(Firestore)</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bd071d9ef26e805b3ae48e071de7a41/href">https://medium.com/media/0bd071d9ef26e805b3ae48e071de7a41/href</a></iframe><p>In the code above, we add SdpObserver and MediaConstraints to it by calling the peerConnection.createOffer method. Briefly, we add offer’s sdp values into WebRTC. Then we take the meetingID value and save it to our database aka Firestore.</p><p><strong>2- Receiving Offer SDP and Creating Answer SDP</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a62f5620ff072b76852b6d988dc17877/href">https://medium.com/media/a62f5620ff072b76852b6d988dc17877/href</a></iframe><p><strong>3- Transmission Answer SDP to Server</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7711ecddb05702db323f95cbcb23d12e/href">https://medium.com/media/7711ecddb05702db323f95cbcb23d12e/href</a></iframe><p>After the transfer, it goes to CallBack in VoiceCallActivity.kt and the client sent the Offer SDP to WebRTC with the following method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/513359c52c5b2977c23fc47a62493ce0/href">https://medium.com/media/513359c52c5b2977c23fc47a62493ce0/href</a></iframe><p>For now, we’re done with Offer and it’s time to create an Answer SDP. We create the following method for Answer as we did for Offer and send it to Firestore.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fff2a78f4a4aa3ff96c065f60bb9091/href">https://medium.com/media/2fff2a78f4a4aa3ff96c065f60bb9091/href</a></iframe><p><strong>4- Listen Answer SDP and Transfer WebRTC</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa815b76ecc468a466731588445af643/href">https://medium.com/media/fa815b76ecc468a466731588445af643/href</a></iframe><p><strong>5- Offer/Answer SDP transfers are completed</strong></p><p>Offer/Answer SDP transfers are completed and after the connection, media transfers and the conversation is started.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09340bc5c27eee60529f3edc43edd0cf/href">https://medium.com/media/09340bc5c27eee60529f3edc43edd0cf/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3574358923b8af3471bdff8a7d7fa242/href">https://medium.com/media/3574358923b8af3471bdff8a7d7fa242/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/602ca9c7d99031ba2d683bd8d399dcd9/href">https://medium.com/media/602ca9c7d99031ba2d683bd8d399dcd9/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edb5c293f41d3881bb6ab43870cdd09a/href">https://medium.com/media/edb5c293f41d3881bb6ab43870cdd09a/href</a></iframe><p>The incoming SDP information is transferred to WebRTC and listened in CallActivity.</p><p><strong>Ice Candidates</strong></p><p>The transfer process of our ICE candidates progresses in parallel with SDP transfers. In other words, successful communication is established when both the SDP and ICE candidate processes are completed. Therefore, both the SDP and ICE candidate processes are two important pieces that complement each other and are necessary to establish communication.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ef54ef9e5034de42d7dbfcf9c7fedd6/href">https://medium.com/media/3ef54ef9e5034de42d7dbfcf9c7fedd6/href</a></iframe><p>Thanks to the Callback method above, Ice Candidates are started to be produced.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbe3631cf401dabedbbfe6ebe6aff02/href">https://medium.com/media/4dbe3631cf401dabedbbfe6ebe6aff02/href</a></iframe><p>Now it’s time to add Ice Candidates to Firestore. After the Firestore addition is complete, we transfer Ice Candidate to WebRTC.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe095256d982ae1e6fd4fefc73fc0848/href">https://medium.com/media/fe095256d982ae1e6fd4fefc73fc0848/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2596b6e6d6dc78a241daebaf451ab8bc/href">https://medium.com/media/2596b6e6d6dc78a241daebaf451ab8bc/href</a></iframe><p>The information of each ICE candidate produced is sent to these functions in SignalingClient and WebRTC, and is written to the Candidates Collection in Firestore with meetingID, and sent to WebRTC.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7daf07cac90d7f57181afcf90b2e0576/href">https://medium.com/media/7daf07cac90d7f57181afcf90b2e0576/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9436d18b848179fa3c2cf07a08ff1876/href">https://medium.com/media/9436d18b848179fa3c2cf07a08ff1876/href</a></iframe><p>IceCanditate data returned from the above Callback is transferred to the addIceCandidate method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2596b6e6d6dc78a241daebaf451ab8bc/href">https://medium.com/media/2596b6e6d6dc78a241daebaf451ab8bc/href</a></iframe><p>As the last step we always do, we transfer the incoming data to WebRTC. Thus, WebRTC establishes the connection by choosing the most suitable way for us.</p><h4>Conclusion</h4><p>In this article, I explained WebRTC usage with Firestore using Kotlin. I used Firestore but you can use Huawei Cloud DB instead of Firestore. For details please refer <a href="https://medium.com/huawei-developers-tr/webrtc-nedir-ve-kotlinde-huawei-clouddb-ile-nas%C4%B1l-kullan%C4%B1l%C4%B1r-755feb42f3b1">this article</a>. If you have any questions, please leave a comment. Thanks for reading.</p><h4><strong>References</strong></h4><ul><li><a href="https://webrtc.org/">WebRTC</a></li><li><a href="https://firebase.google.com/docs/firestore">Firestore | Firebase</a></li><li><a href="https://github.com/damlayagmur/QuickLine">GitHub - damlayagmur/QuickLine</a></li><li><a href="https://github.com/damlayagmur/WebRTC-Firestore">GitHub - damlayagmur/WebRTC-Firestore</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fd7d6c1652b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Timber ile Kolay Loglama — Android]]></title>
            <link>https://medium.com/huawei-developers-tr/timber-ile-kolay-loglama-android-9d9d23f4e6ab?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9d23f4e6ab</guid>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[timber]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Wed, 12 Oct 2022 11:06:49 GMT</pubDate>
            <atom:updated>2022-10-13T18:19:58.767Z</atom:updated>
            <content:encoded><![CDATA[<h3>Timber ile Kolay Loglama — Android</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jl0alGD2wyv-SA5jzFeqPQ.jpeg" /></figure><h4>Giriş</h4><p>Herkese merhaba,</p><p>Bu yazıda loglama işini kolaylaştıran Timber kütüphanesini inceleyeceğiz. Öncelikle loglama kavramına bakalım. Loglar kodun tam olarak ne yaptığını anlamamıza yarar ve çalıştığı mevcut verilerle ilgili bilgileri yazdırma veya kaydetme işlemidir. Ayrıca yazdığınız kod hakkında değerli bilgiler sağlayıp hayat kurtaran işlevler görebilir. Örneğin; performans sorunları, çeşitli buglar ve diğer sorunları keşfetmek için kullanılır.</p><h4>Timber Nedir?</h4><p>Gelelim Timber kütüphanesine, Jake Wharton tarafından geliştirilen bir log kütüphanesidir.</p><p><strong>Peki bize faydaları nelerdir? Neden tercih etmeliyiz?</strong></p><ul><li>Loglama yaparken her class için tek tek TAG oluşturmamıza gerek kalmaz. Timber kütüphanesi bu TAG’leme işini otomatik olarak logun kullanıldığı class ismine göre yapar.</li><li>Uygulama yayınlanma aşamasına geldiğinde loglar için endişelenmenize gerek kalmaz çünkü Timber kütüphanesi sayesinde bu loglar yayınlanacak APK içerisine eklenmez. Yani yayınlamadan önce logları tek tek silmenize gerek kalmaz.</li></ul><p><strong>Timber Kütüphanesini Projeye Eklemek</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da1f656c0f97e3dbbd88d90a5650b0e4/href">https://medium.com/media/da1f656c0f97e3dbbd88d90a5650b0e4/href</a></iframe><p><strong>Not:</strong> Şu andaki güncel versiyon bu fakat kullanacağınız zaman güncel versiyonu <a href="https://github.com/JakeWharton/timber">GitHub</a> üzerinden kontrol edebilirsiniz.</p><p>Şimdi sırada projedeki logları eklediğimiz kütüphane ile düzenlemek var.</p><p>Aşağıdaki log projede kütüphane kullanmadan önceki hali;</p><pre>Log.e(&quot;LoginViewModel&quot;, result.errorMessage.<em>toString</em>())</pre><p>Şimdi sadece Log kısmını Timber ile değiştiriyoruz ve kullanıma hazır hale geliyor.</p><pre>Timber.e(result.errorMessage.<em>toString</em>())</pre><p>Bunu her log için yapabiliriz. Log.v(), Log.d(), Log.i(), Log.w(), ve Log.e().(Bu logların ne işe yaradığına ve detaylı açıklamalarına <a href="https://developer.android.com/reference/android/util/Log">bu dokümandan</a> erişebilirsiniz.) Tek yapmanız gereken Log yerine <em>Timber</em> eklemek.</p><h4>Timber ile TAG kullanmak</h4><p>Yukarıdaki örnekte loglama için kullandığımız TAG class ismiydi yani Timber kütüphanesi TAG’leme ismini otomatik class’a göre yapmıştı. Peki ya bizim class isminden farklı bir TAG’a ihtiyacımız olursa ne yapacağız?</p><p>Aşağıdaki örnekte görüldüğü üzere log TAG’ımız “USER”.</p><pre>Log.i(&quot;USER&quot;, user.toString())</pre><p>Şimdi Timber kütüphanesi ile güncelleyelim. Eklemek istediğiniz TAG’ı aşağıdaki gibi <em>.tag </em>olarak ekleyebilirsiniz.</p><pre>Timber.tag(&quot;USER&quot;).i(user.toString())</pre><h4>Sonuç</h4><p>Bu kütüphane ile artık loglama işlemini daha verimli ve kolay bir hale getirebilirsiniz ve yayınlanma aşamasında logları dert etmeden uygulamanızı yayınlayabilirsiniz.</p><p>Umarım beğenirsiniz. Okuduğunuz için teşekkürler. Herhangi bir sorunuz olursa yorum bırakabilirsiniz.</p><h4>Kaynaklar</h4><p><a href="https://github.com/JakeWharton/timber">GitHub - JakeWharton/timber: A logger with a small, extensible API which provides utility on top of Android&#39;s normal Log class.</a></p><p><a href="https://developer.android.com/reference/android/util/Log">https://developer.android.com/reference/android/util/Log</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9d23f4e6ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers-tr/timber-ile-kolay-loglama-android-9d9d23f4e6ab">Timber ile Kolay Loglama — Android</a> was originally published in <a href="https://medium.com/huawei-developers-tr">Huawei Developers - Türkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XML Dosyalarımızı Alt Klasörler Kullanarak Nasıl Gruplarız?]]></title>
            <link>https://medium.com/huawei-developers-tr/xml-dosyalar%C4%B1m%C4%B1z%C4%B1-alt-klas%C3%B6rler-kullanarak-nas%C4%B1l-gruplar%C4%B1z-c7784baa856a?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7784baa856a</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[layout]]></category>
            <category><![CDATA[xml]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 05:02:59 GMT</pubDate>
            <atom:updated>2022-08-11T06:43:31.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*iBx11Ne1mA-HAKb1.png" /></figure><h4>Giriş</h4><p>Herkese merhaba,</p><p>Bu yazımda büyük projelerde layout dosyalarımızı nasıl karışık ve yönetilemez durumdan kurtarırız ona bakacağız. Hepimizin bildiği üzere projede xml dosyalarımız <strong><em>res/layout</em></strong> altında bulunur. Küçük projelerde daha az xml dosyası olduğu için bunları yönetmek zor olmaz fakat projemiz büyüdükçe ve xml dosyaları arttıkça hangi xml uygulamadaki hangi ekran ve özellik için kullanılıyor bulmak zorlaşır ve fazlaca vakit alır. Tüm bunlardan kaçınmak için xml dosyalarımızı gruplamak en mantıklı çözüm. Gelin şimdi bunu nasıl yapıyoruz, xml dosyalarımızı nasıl düzenliyoruz ona bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*RUGygTV5cr3pELPb.png" /><figcaption>Küçük Projelerde XML Dosyaları</figcaption></figure><p>Yukarıdaki örnek daha az xml dosyasına sahip dolayısıyla yönetmek daha kolay. Ama aşağıdaki örnekte tam tersi çok fazla xml dosyası var.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*orPyRvMZGM3HCTeo.png" /><figcaption>Büyük Projelerde XML Dosyaları</figcaption></figure><p>Bu yazıda xml dosyalarını ayırırken ana özellikler üzerinden gideceğiz. Siz de projenizde düzenleme yaparken uygulamanın ana özelliklerine odaklanabilirsiniz.</p><p>Bu projede 5 tane ana özellik mevcut o yüzden 5 tane alt klasör oluşturacağız.</p><ul><li>İlk önce Android Studio’da <strong><em>Project</em></strong> görünümünü seçiyoruz. Çünkü Android görünümünü seçersek ayrılmış alt klasörleri göremeyiz.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*ssGPwI9R2e9_ub_K.png" /><figcaption>Android Studio’da Project Görünümü</figcaption></figure><ul><li>Daha sonra res klasörüne sağ tıklayarak yeni dizin oluşturuyoz, <strong><em>New &gt; Directory. </em></strong>Bu yeni dizine <strong><em>layouts</em></strong> adını veriyoruz.</li><li>Şimdi sırada ana özelliklere göre alt klasörlemizi oluşturmak var, az öncede bahsettiğim gibi bu örnekte 5 alt klasör oluşturacağız. layouts dizinine gelip sağ tıklıyoruz ve <strong><em>New &gt; Folder &gt; Res Folder </em></strong>seçiyoruz ve alt klasörümüze uygulama ana özelliklerine uyan bir isim veriyoruz. Bu yazıdaki örnek için bu alt klasörler <em>login, home, notification, meetingpeople and profile</em>. Yeni bir alt klasör oluşturduğumuzda gradle çalışmaya başlar ve build.gradle(app) içine bu alt klasörler için gerekli düzünlemeleri ekler.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/0*Ex9GQ2XM656NhaAX.png" /><figcaption>build.gradle(app)</figcaption></figure><p>Alt klasörlerimizi oluşturduktan sonra alt klasörlerimizin hepsinin içine yeni bir dizin ekliyoruz.</p><ul><li>Alt klasörlerimizi oluşturduktan sonra alt klasörlerimizin hepsinin içine yeni bir dizin ekliyoruz., <strong><em>New &gt; Directory. </em></strong>Bu sefer bu dizinimizin adı <strong><em>layout.</em></strong></li><li>Şimdi tek yapmamız gereken layoutlarımızı ilgili alt klasörlere taşımak. Bu örnekteki 5 alt klasöre bölünen layoutlar bu şekilde gözüküyor.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/0*HzQSNEY-0cV9u-ZL.png" /><figcaption>Alt Klasörlere Bölünen XML Dosyaları</figcaption></figure><p><strong>Not:</strong> En son eskiden xml dosyalarınızın bulunduğu original layout klasörünü silmelisiniz ve isteğe bağlı layouts olarak isimlendirdiğimiz dizinin adını layout olarak düzenleyebilirsiniz.</p><h3>Sonuç</h3><p>Xml dosyalarımızı gruplandırdıktan sonra artık istediğimiz dosyayı daha rahat bulabiliriz ve layoutları çağırırken farklı bir şey yapmamıza gerek yok. Örneğin yine <em>R.layout.activity_main şeklinde çağırabiliriz.</em></p><p>Umarım beğenirsiniz. Okuduğunuz için teşekkürler. Herhangi bir sorunuz varsa yorum bırakabilirsiniz.</p><h3>Kaynaklar</h3><p><a href="https://developer.android.com/studio/write/add-resources.html">https://developer.android.com/studio/write/add-resources.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7784baa856a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers-tr/xml-dosyalar%C4%B1m%C4%B1z%C4%B1-alt-klas%C3%B6rler-kullanarak-nas%C4%B1l-gruplar%C4%B1z-c7784baa856a">XML Dosyalarımızı Alt Klasörler Kullanarak Nasıl Gruplarız?</a> was originally published in <a href="https://medium.com/huawei-developers-tr">Huawei Developers - Türkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[‍ Huawei Ability Gallery — Showing Nearby Places on the Card (Part 1)]]></title>
            <link>https://medium.com/huawei-developers/huawei-ability-gallery-showing-nearby-places-on-the-card-part-1-130b51b48705?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/130b51b48705</guid>
            <category><![CDATA[card-ability]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[geolocation]]></category>
            <category><![CDATA[huawei-ability-gallery]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Tue, 04 Jan 2022 12:51:02 GMT</pubDate>
            <atom:updated>2022-03-04T08:23:16.176Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://medium.com/p/b24b04764fdd/edit">👨🏼‍💻</a> Huawei Ability Gallery — Showing Nearby Places on the Card (Part 1)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b76ULkaVPRmKf7_GoJBfjA.jpeg" /></figure><p>Hi everyone,</p><p>As we all know, lately, when people go about their day-to-day chores, it has become more important for them to make the timing right. Therefore, when planning to go to places like ATMs, cafes, museums, etc., they try to choose the ones closest to where they are. They can find nearby places by searching them on the web, or by installing the mobile applications which are developed to do this job for users. In phones which include Huawei Mobile Services, we can show nearby places to users in the Huawei Assistant Page thanks to Huawei Ability Gallery. And in this article, we are going to talk about how we can do that. We will develop a card to show nearby places to the user.</p><p><strong>Note:</strong> Before you start reading this article, you can take a look at the article below to understand the Huawei Ability Gallery and the Card Ability concepts.</p><p><a href="https://medium.com/huawei-developers/huawei-ability-gallery-card-ability-4d898e3fb5b8">Huawei Ability Gallery — Card Ability</a></p><p>Showing Nearby Places on the Card Topic is divided into two parts. The first part which will be explained in this article, includes card design/development in Quick App IDE and Huawei Console Configuration for the card. The second part which will be explained in the other part of this article (Huawei Ability Gallery — Showing Nearby Places on the Card (Part 2)), includes getting user location from the app and sending it to the card using <a href="https://developer.huawei.com/consumer/en/doc/distribution/service/hag-guide-event-push">Event Push</a> .</p><p>Here are the things we need for this part:</p><ol><li>Quick App IDE (latest version)</li><li>An enterprise account registered in <a href="https://developer.huawei.com/consumer/en/">Huawei Developer Official Site</a></li></ol><p>First, we will look at card design/development in Quick App IDE</p><h4>Card Design/Development</h4><p>First of all, we need to create a new project for card. So, after you open Quick App IDE, please go to New Project -&gt; Widget then select “Phone — Android” option. And then click “Next” button.</p><figure><img alt="Create a new Widget Project" src="https://cdn-images-1.medium.com/max/700/0*1djMV4vtps8gTZab.png" /><figcaption>Create a new Widget Project</figcaption></figure><p>In the “Select Template” section, you can choose any template appropriate for your project and click “Next” again. In this process, we will select <strong>Vertical Template -&gt;News_and_information </strong>template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*j3H_bwQgM9JEGPja.png" /><figcaption>Selecting Template</figcaption></figure><p><strong>Note:</strong> If you want to design your own template, you can select Empty template in Universal Template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*LWHQshrW7G4Wca62.png" /><figcaption>Empty Template Selection</figcaption></figure><p>But note that, if you are going to design the card yourself, you must follow the UX design guidelines outlined in <a href="https://developer.huawei.com/consumer/en/doc/distribution/service/hag_card_ux">this</a> document.</p><p>After selecting a template, please fill App Name, Package name fields and select a Workspace. Then click “OK”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/0*C2HSgqxbR-00PFr2.png" /><figcaption>Set Project Params</figcaption></figure><p>After creating the project, you will see a screen like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_gVOZWjDqkK2322Z.png" /><figcaption>Project Development Page</figcaption></figure><p>On this screen, you can see the “Explorer” panel on the left. Go to Explorer Panel and extend COM.GEOLOCATION.DEMO (your package name) , src , news_and_information_type folders respectively.</p><p><strong>Note:</strong> In common-&gt;component folder you can see card_bottom and card_title items. These can be explained in the following.</p><ul><li><strong>card_bottom :</strong> It contains properties of items at bottom of the card, which can be button or array of buttons</li><li><strong>card_title :</strong> It contains properties of title at the top of the card, which is name of the service application providing the card items.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*0X3IYDOFuslnAzgM.png" /><figcaption>Card Title and Card Bottom Specification</figcaption></figure><p>In this article, we will focus on news_and_information_type.ux which contains properties of main items which are placed in the middle of the card. If you want to customize the card title and card bottom you can update the codes in UX files of them.</p><p>In <strong>news_and_information_type.ux</strong>, there are three parts which are divided with tags. These are :</p><ul><li>&lt;template&gt;</li><li>&lt;style&gt;</li><li>&lt;script&gt;</li></ul><p>We will focus on &lt;script&gt; part to develop our card and &lt;template&gt; part to set our card items’ feature.</p><p><strong>Note: </strong>Due to UX design rules, Quick App IDE doesn’t allow you to update any tag in &lt;template&gt; part manually . You can add/delete components only by the methods described in <a href="https://developer.huawei.com/consumer/en/doc/distribution/service/5060427#h2-1589162607379-1">this</a> guide.</p><p>In the next part of the article, we will proceed by assuming that we have a bank application as an example and that nearby ATM information is kept in the backend in this bank application. Now, let’s assume that the information in this backend comes to us in a JSON object called <strong>sites</strong>.</p><p>First of all, in order to pull the data in this object one by one, we will replace &lt;block for=”{{$t(‘message.items’)}}”&gt; phase with &lt;block for=”{{sites}}”&gt;, which is in the &lt;template&gt; section of our code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85eb2bcd9187bebe4af8470af14fab25/href">https://medium.com/media/85eb2bcd9187bebe4af8470af14fab25/href</a></iframe><p>We need to determine which data on the card will be got from the backend of the app providing data . The names of the data must be same as the name of items in our backend. After determining we named these data defined with the same name in API, we define them by creating a scope called “props”. So, we create a <a href="https://developer.huawei.com/consumer/en/doc/development/quickApp-References/quickapp-script-0000001073643163#section1948115360451">props </a>array that will hold the sites object under the <strong>module.export</strong> in the &lt;script&gt; section of our code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8344e07537b87e8a4d6041b6e221423b/href">https://medium.com/media/8344e07537b87e8a4d6041b6e221423b/href</a></iframe><p>Additionally, we need to define one more object named “sites” in “data” scope to hold data coming from the backend through the sites object. And also within this sites object, we need to define variables which we will be able to assign the information we will pull from the . For this case, we will replace the “items” object name with “sites” , “msgOne” variable name with “bankName” and “msgTwo” variable name with “distance”.</p><p><strong>Note: </strong>All variable names in the data object must be exactly the same as all the variable names you will send from your backend to the card.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/949496edafa6f1f6544b14166175d966/href">https://medium.com/media/949496edafa6f1f6544b14166175d966/href</a></iframe><p>And we pull the data from the backend with “parameters” keyword.</p><p><strong>Note:</strong> The variable which will keep the parameters must have same name in the backend and parameter required by onInit() function in Quick App IDE.</p><h3>Console Configuration</h3><p>Now time to card configuration on the console. You need an enterprise account for using HAG. Please sign in console with your enterprise account and select the Smart Services for HAG as in the following screenshot. In this example, we used Europe. If your region is different from Europe please select the part that suits your region and continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qP323S_yX4-2rIIi.png" /></figure><p>Then we need to create a new ability. You can find details in screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*H6Lq5TzrumVmhxcn.png" /></figure><p>When we select create ability, we encounter the screen in the screenshot below. Then we select Custom ability model and fill the ‘Ability Name’, ‘Category’ and ‘Default Language’ part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*UzfJI7gHkuHVhF4T.png" /></figure><p>After clicking the ‘Create’ button, we have to fill in some necessary information. As in the screenshot, the Basic information, Country/Region and Display information section ask for some information on the detail pages. We must fill in this information completely and save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cV2wLDO2jCLnvSqv.png" /></figure><p>On the ‘Display Information’ page, you can add Short and Full Description with icons. If you wonder ‘What are the short and full descriptions?’ You can use a question mark in the screenshot or you can check <a href="https://developer.huawei.com/consumer/en/doc/development/service/5060430">this document</a> for a detailed explanation. You can also find the size that should be used for the icons and images you will add to this page. For example, you have to use 72 x 72px for ‘Small Icon’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ElzCE1uXzkP8XgLt.png" /></figure><p>And in the Display Information, you can add other languages. For example, you will release a card in different countries, so the display information of the card should also change. From here, you can add a new language by clicking the Manage Language section. Then you can switch between these languages ​​and use new images suitable for the language you added.</p><p>After completing to fill ‘Ability Information’ part, we can start ‘Confıgure’ part. In the Configure part, we need to add an intent for our card. For the Geolocation demo, we used Event Push so we have to add Event Intent. If you want to examine Event Push in detail, you can check <a href="https://developer.huawei.com/consumer/en/doc/development/service/hag-guide-event-push">this document</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*-FF6yXGINT8USbta.png" /></figure><p>Then we fill in the necessary information for event intent. We need a ‘Fulfillment’ for intent. We click ‘Configure’ for creating a new fulfillment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wZQZF1Quq0YO-Pwu.png" /></figure><p>We uploaded the card RPK file that we have completed in QuickApp IDE to the Upload card package section. And then we select the service links part. In this demo user will be directed to the app, so we selected Link to the app. If you open the Quick App or HTML5 page instead of an app, you should select the appropriate one from the other options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*u80ctI4qalwNXnoW.png" /></figure><p>Then you should fill in the required information according to the service link you chose. Here are the parts we need to fill in</p><ul><li>Link URL</li><li>App package</li><li>Min. app version supported</li></ul><p>And another feature we need is Account Binding but it is not this article subject so please check <a href="https://developer.huawei.com/consumer/en/doc/hag-guide-accountbinding-card">this document</a> for details. For the geolocation demo you can add Account Binding via the Account linking part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ci9FM0NVaNNiLmif.png" /></figure><p>After adding the ‘Account Binding’ part, time to test. For testing, you can use ‘Test’ part on console. Please click ‘Prepare Test’ button. For card test details, please check <a href="https://developer.huawei.com/consumer/en/doc/5060433">this document</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4fgoi9IB2xnpXltU.png" /></figure><p><strong>Note: </strong>If you change any part of the card configuration part, please do not forget to click the Prepare Test again button.</p><p>For the second part of the development, please refer to the following article.</p><p><a href="https://medium.com/huawei-developers/huawei-ability-gallery-showing-nearby-places-on-the-card-part-2-dd1923c61d1">Huawei Ability Gallery — Showing Nearby Places on the Card (Part 2)</a></p><h3>References</h3><ul><li><a href="https://developer.huawei.com/consumer/en/doc/distribution/service/5060422">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/distribution/service/hag_card_ux">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/distribution/service/hag-guide-event-push">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=130b51b48705" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/huawei-ability-gallery-showing-nearby-places-on-the-card-part-1-130b51b48705">👨🏼‍💻 Huawei Ability Gallery — Showing Nearby Places on the Card (Part 1)</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[Huawei Auth Service usage with Google Account — Method 2]]></title>
            <link>https://medium.com/huawei-developers/huawei-auth-service-usage-with-google-account-method-2-2a5d2cc562e6?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a5d2cc562e6</guid>
            <category><![CDATA[huawei-auth-service]]></category>
            <category><![CDATA[google-auth]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 08:24:54 GMT</pubDate>
            <atom:updated>2021-11-25T08:24:54.759Z</atom:updated>
            <content:encoded><![CDATA[<h3>Huawei Auth Service usage with Google Account — Method 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U-LSe23B8jdE8aRcgWopag.jpeg" /></figure><p>Hello everyone,</p><p>In this article, we will talk about HMS Auth service usage with Google Account — Method 2.</p><p><strong>HMS Auth Service: </strong>Most apps need to identify and authenticate users. You can fulfill these requirements quickly and securely using HMS Auth Service.</p><p>You can choose to provide your users with one or more of the authentication modes. In this article, we use Google Account — Method 2.</p><p><strong>Note: </strong>Google Authentication mode has a GMS dependency. You cannot use it on HMS phones. We used to be able to do this using webviews, but now this usage has been removed due to some security problems. If you wonder details, you can check <a href="https://developers.googleblog.com/2021/06/upcoming-security-changes-to-googles-oauth-2.0-authorization-endpoint.html">this post</a>.</p><p>To use Huawei Auth Service, firstly you must finish HMS Core integration part. You can use the document in the link to easily integrate HMS Core.</p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0">Preparations for Integrating HUAWEI HMS Core(Android)</a></p><h3>Configurations</h3><p>We need to enable Auth Service on AGC Console. You can find Auth Service in <strong>Build</strong> part. Click Enable now button to enable Auth Service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ux5_WHnwVOufMK0FVLiKCQ.png" /></figure><p>After enabling Auth Service, we need to enable authentication mode we will use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k613saQTESDYAvf6rjgWSA.png" /></figure><p>When Google Authentication mode is enabled, the page in the screenshot below will appear. Using the <a href="https://console.cloud.google.com/apis/credentials">Google API Console</a>, we should create Client ID and Client Secret but you can create Client ID and Client Secret with using Firebase project. We are using Firebase in this article project.</p><p><strong>Note:</strong> The ‘com.google.android.gms.common.api.ApiException: 10’ displays, when I did it using Google API Console. I also found the Firebase solution and used it to solve this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*tnAe01lNxEvaGCzXrnJJ1A.png" /></figure><p>Now, please create a Firebase project and go to project settings. We need to add our app in this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9mMzJYVi0FEwUUOo83jdQ.png" /></figure><p>Then, on the add app page, we just need to fill in the package name of our app. In the other steps, what we do through the AGC Console is enough. For example we do not need to use Firebase config file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*Sn3SEJd0wkPoaFKvN9HUiQ.png" /></figure><p>Now, let’s add the fingerprint information required for the app from the project settings section. Actually, adding one of SHA-1 or SHA-256 is enough here, but let’s add both fingerprints for avoiding errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*8nFtvwCQyG9RCyufkZufJQ.png" /></figure><p>We can easily access SHA-1 and SHA-256 information via Android Studio. You can access the fingerprint information of your project by clicking the signingReport section from the Gradle section on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*eSbL909zU1cKVU5BgIYNeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*uvDxdj_GVx9Tyb3zXNnr1Q.png" /></figure><p>Then we enable Google from the Authentication sign-in method section. <br>After Google is enabled, we copy the Client ID and Client Secret parts in the screenshot and add them to the AGC console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bo_gPQwQdpntmrWzwB9tLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCJuUqELEo9pBsFmjs6H4A.png" /></figure><p>We have completed our configuration steps on the console, we can move on to the code part.</p><h3>Coding</h3><p>First, we have to add the implementation part for HMS Auth Service and Auth Service-Google Account.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba50a0fb93d021fbff7dfe19086f14cc/href">https://medium.com/media/ba50a0fb93d021fbff7dfe19086f14cc/href</a></iframe><p>After that, we need to add Google Sign-In button. As with the Huawei Sign-In button, Google Sign-In button has a design feature that we need to pay attention. In this project, we can use this code for button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dd7e7b3d9ed6ba36c5a9aff77f15029/href">https://medium.com/media/3dd7e7b3d9ed6ba36c5a9aff77f15029/href</a></iframe><p>When the user clicks this button we will call the signInGoogle method. We need to add our client id value to the requestIdToken. We have just obtained the client id value from Firebase and added it to the AGC Console.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c007be685afee4f19d885b792438358/href">https://medium.com/media/8c007be685afee4f19d885b792438358/href</a></iframe><p>If we use more than one sign-in method in our application, we must call the required sign-in method here with requestCode.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb0af627e84faaf0d875fb7c370e7595/href">https://medium.com/media/fb0af627e84faaf0d875fb7c370e7595/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c8e6706647dd2a1b02ff6fd1291274a/href">https://medium.com/media/4c8e6706647dd2a1b02ff6fd1291274a/href</a></iframe><p>After completing the coding part, we can test our application. In the screenshots below, you can see the screens that you need to accept to use your Google account for sign-in after clicking the Google Sign-in button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*RvYxhbhddnaUIcnpmw9tKQ.png" /></figure><h3><strong>Output</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*joXOPFKSEzbg7z4s2GWSEQ.gif" /></figure><h3>Tips &amp; Tricks</h3><ol><li>Please do not forget to add fingerprint information in Firebase Project.</li><li>Please do not forget to use Web Client ID and Web Client Secret from Firebase.</li><li>Please do not forget to add Client ID information in code. You can see the code line you need to add in the signInGoogle.kt in the above Gist.</li></ol><h3>Conclusion</h3><p>In this article, I explained Google Account usage for HMS Auth Service. I hope you will like it. Thank you for reading. If you have any questions, you can leave a comment or ask via <a href="https://forums.developer.huawei.com/forumPortal/en/home">Huawei Developer Forum</a>.</p><h3>References</h3><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-introduction-0000001053732605">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-google-0000001053372648">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a5d2cc562e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/huawei-auth-service-usage-with-google-account-method-2-2a5d2cc562e6">Huawei Auth Service usage with Google Account — Method 2</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 apply minor and major(force) update with Huawei Remote Configuration?]]></title>
            <link>https://medium.com/huawei-developers/how-to-apply-minor-and-major-force-update-with-huawei-remote-configuration-14c5a462cc25?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/14c5a462cc25</guid>
            <category><![CDATA[huawei-mobile-service]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[remote-configuration]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Fri, 01 Oct 2021 10:48:31 GMT</pubDate>
            <atom:updated>2021-10-01T10:48:31.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m4BL3LkUbXtzbGv6Q9LiZg.png" /></figure><h3>Introduction</h3><p>Hello everyone,</p><p>In this article, I will talk about check updates with Huawei Remote Configuration.</p><p><strong>Remote Configuration:</strong> We can use remote configuration for different purposes. For example, you can change appearance and behavior of the app without updating. And other usage of remote configuration is checking for updates.</p><p>To use Huawei Remote Configuration, firstly you must finish HMS Core integration part. You can use the document in the link to easily integrate HMS Core.</p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0">Preparations for Integrating HUAWEI HMS Core(Android)</a></p><h3><strong>Configurations</strong></h3><p>On the AGC Console, you can find Remote Configuration in <strong>Grow</strong> part. Click Enable now button to enable Remote Configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hdoSMeT76xYqkjopTCAbyA.png" /></figure><p><strong>Note: </strong>After enabling, check and update your json file. If you do not use the latest version of the json file, you will get an error.</p><p>Add the Remote Configuration dependency in the <strong>build.gradle</strong> file in your app’s module directory.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99afad7c066516d2f31ec5f09d18716d/href">https://medium.com/media/99afad7c066516d2f31ec5f09d18716d/href</a></iframe><h3><strong>Development</strong></h3><p>Let’s develop an app step by step.</p><p>We have a two scenario for updates. These are minor and major update. For minor updates, user can cancel the version update but for major updates, user cannot cancel app update. In major updates, users have to update app.</p><ul><li><strong>Minor Update</strong></li></ul><p>-First let’s start to develop minor update scenario. We need to create remote configuration parameters on console. Click New parameter button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSQRWcSblX2TiX3fkPu7tg.png" /></figure><p>-Enter the parameter name and default value as seen in the below screenshot. If you want to explain this parameter briefly to remember, you can add description. After adding necessary information, click the save button at the top right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pgqt7AAVib7eK3K3cLLEJQ.png" /></figure><p>-After the parameter adding and saving processes are completed, you need to release these parameters in order to use them through the app. You can create and release multiple parameters at the same time, you do not need to release all of them one by one. <strong>Please do not forget the release step, otherwise you cannot use these parameters.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyOsMXZpof3tMPcxwBw1IQ.png" /></figure><p>-For checking app update, we need to get current app version and compare this value with remote configuration parameters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cda0b9804b750bd136cb21502c30f33e/href">https://medium.com/media/cda0b9804b750bd136cb21502c30f33e/href</a></iframe><p>-After that we have to check app needs minor or major update. In this demo, we can check this updates in Splash Screen. We use comparison values ​​here as an example, you can adjust these values ​​according to your app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e512f988a29d1f2dc6cd47a6cbf4c527/href">https://medium.com/media/e512f988a29d1f2dc6cd47a6cbf4c527/href</a></iframe><p>-Then we show a minor or major update with redirecting to Main Activity according to the values ​​obtained as a result of the check.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2f08a01aba9173a3b564df38d9205e7/href">https://medium.com/media/d2f08a01aba9173a3b564df38d9205e7/href</a></iframe><p>-You can also change data type of intent.putExtra and intent.getStringExtra <br>according to your own requirements.</p><p>-After that we initialize remote config.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7db1def2e08b1e4065ff37a9e619ead4/href">https://medium.com/media/7db1def2e08b1e4065ff37a9e619ead4/href</a></iframe><p>-Now it remains to take the remote configuration parameters, compare them with the current app version and open the necessary dialogs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/511f6bcdf2f25853035d60d65ffb42f9/href">https://medium.com/media/511f6bcdf2f25853035d60d65ffb42f9/href</a></iframe><p>*appVersion variable using the getAppVersion method that we just saw, this variable represents the current app version.</p><p>*After completing the remote configuration fetch operations, time to get the values ​​of the parameters we created.</p><p>*The thing you need to pay attention to here is that you use the getValueAsString part without changing the name of the parameter you created in the console as it is.</p><p>*Then we open a dialog according to the update scenario according to the comparison you made.</p><p>*Remote configuration has some restrictions. You can find restrictions document in the end of the article, References part. You may get some error codes according to these restrictions. If remoteConfig fetch is not successful, you can inform the user.</p><p><strong>Note: </strong>When I developed this app, I got error ‘fetch throttled, try again later.’ The reason for this error is API calls restrictions. If a user makes more than 20 API calls, user has to wait for a 1 hour to renew API call restriction.</p><p>-Now let’s design a dialog for minor update. The user can ignore this update. so we should add cancel or ok button as well. This is my basic design, you can design according to your app. Please pay attention ok and update buttons because the user can exit the dialog without updating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*K9gJJG1VB6P-32XixZeWkA.png" /></figure><p><strong>Redirecting to AppGallery</strong></p><p>-If the users want to update the application, they click the update button and redirect to AppGallery app page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da91daa2c4f85af0779dd2229cd778f7/href">https://medium.com/media/da91daa2c4f85af0779dd2229cd778f7/href</a></iframe><p>-In this code, I used Huawei Browser package name because my app is not release on AppGallery. I wanted to see redirecting to AppGallery. If your app is released, you can get the package name as in the comment line and redirect it to your own app page. Make sure that the link in the catch section also belongs to the same app.</p><p><strong>Minor Update Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*uLzwP6dsz3OEp3AAs64ZhA.gif" /></figure><ul><li><strong>Major Update</strong></li></ul><p>Actually, all the steps we do here will still be the same with minor update except dialog design.</p><p>Again, we get parameters from the console and compare it with the current version.</p><p>The most important part for us here is the dialog part. <strong>The user cannot ignore the application update. That’s why major update also called a force update.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*_itYeqihaqPK1TRwxuXAOw.png" /></figure><p><strong>Major Update Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*X3baXupneaVRNobeQgF0Uw.gif" /></figure><h3>Tips &amp; Tricks</h3><ol><li>Please use latest json file after enabling Remote Configuration.</li><li>Do not forget to release parameters.</li><li>Please check the restrictions document to avoid errors due to restrictions.</li></ol><h3><strong>Conclusion</strong></h3><p>In this article, I explained 2 type of update with Huawei Remote Configuration. I hope you will like it. Thank you for reading. If you have any questions, you can leave a comment or ask via <a href="https://forums.developer.huawei.com/forumPortal/en/home">Huawei Developer Forum</a>.</p><h3><strong>References</strong></h3><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-introduction-0000001055149778">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-restrict-0000001054997462">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c5a462cc25" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/how-to-apply-minor-and-major-force-update-with-huawei-remote-configuration-14c5a462cc25">How to apply minor and major(force) update with Huawei Remote Configuration?</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[Account Kit SMS Verification with Java]]></title>
            <link>https://medium.com/@damlayagmur/account-kit-sms-verification-with-java-a7dda330a2b7?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7dda330a2b7</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[sms-verification]]></category>
            <category><![CDATA[accountkit]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <category><![CDATA[hms]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Tue, 16 Mar 2021 07:47:51 GMT</pubDate>
            <atom:updated>2021-03-16T07:47:51.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*sHYzbhrOiUeLQr1ZE70IKA.jpeg" /></figure><p>Hello everyone,<br>In this article, I will talk about SMS Verification for Authorization provided by Account Kit. Nowadays, applications prefer SMS verification to provide secure authorization. The incoming code for SMS verification is called OTP(One-Time Password). Examples of OTP are verification of real users and increasing account security. OTP can be accessed directly within the application. In this way, authorization can be done securely and quickly.</p><p>Firstly, you must create a developer account on Huawei Developers. Then, you should enable Account Kit on Console and make it ready for use. You can use the document below to link for HMS integration.</p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0">Preparations for Integrating HUAWEI HMS Core(Android)</a></p><p>SMS verification is provided by Account Kit so we have to integrate Account Kit into our project. After completing the gradle repo parts, we must add Account Kit implementation app level build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c632266c8054fbd8ac5980770d89e4e6/href">https://medium.com/media/c632266c8054fbd8ac5980770d89e4e6/href</a></iframe><p>After the HMS Core and Account Kit integration is finished, we need to add permissions to the AndroidManifest.xml file for the SMS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26ceb8183a71adb20a49d4fadd636e0b/href">https://medium.com/media/26ceb8183a71adb20a49d4fadd636e0b/href</a></iframe><p>Then we check if the user has given permission. If the user has approved the necessary permissions for the SMS, an SMS will be sent. Please do not forget this part.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16ecafe0580553a25c6b14602cf7039a/href">https://medium.com/media/16ecafe0580553a25c6b14602cf7039a/href</a></iframe><p>After checking the required permissions, we add ReadSmsManager.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f4acaf03e0c0019ac1862ffff42f4e9/href">https://medium.com/media/1f4acaf03e0c0019ac1862ffff42f4e9/href</a></iframe><p>In this part, we are making the necessary additions to be able to use BroadcastReceiver. You will get an error here because we have not created a SmsBrodcastReceiver.class. After the SMSBroadcastReceiver class has been created, the errors here will disappear.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0bfe90fb3c8e55e115239fa2bfc36a4/href">https://medium.com/media/d0bfe90fb3c8e55e115239fa2bfc36a4/href</a></iframe><p>After we are making necessary addition, we adjust the settings we use to send SMS. For the “verification code otp” in the code below, you can use any OTP generator of your choice.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2290e6f9beb6dd7a79ced97c1845bf47/href">https://medium.com/media/2290e6f9beb6dd7a79ced97c1845bf47/href</a></iframe><p>Finally, we create the SmsBroadcastReceiver class that we have just used but not defined. BroadcastReceiver we have created here is used to receive SMS messages. As you can see in the code, we added logs according to the conditions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d3596921a50f6db6e68a90083396a90/href">https://medium.com/media/3d3596921a50f6db6e68a90083396a90/href</a></iframe><p>We briefly made use of the SMS verification process provided by the Account Kit. What is the term OTP and how to read it, we have briefly touched on them.</p><p>I hope you will like it. Thank you for reading. If you have any questions, you can leave a comment or ask via <a href="https://forums.developer.huawei.com/forumPortal/en/home">Huawei Developer Forum</a>.</p><p><strong>References</strong></p><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050048870">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/authotize-to-read-sms-0000001061481826">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7dda330a2b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push Kit ile Geofence Bildirimleri]]></title>
            <link>https://medium.com/@damlayagmur/push-kit-ile-geofence-bildirimleri-34fb668ddca4?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/34fb668ddca4</guid>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[huawei-push-kit]]></category>
            <category><![CDATA[geofence]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 07:50:27 GMT</pubDate>
            <atom:updated>2021-02-23T07:50:27.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*Hx9TiSP7CaHWgVzIfOYCbw.jpeg" /></figure><p>Herkese merhaba,</p><p>Bu yazımda Push Kit ile Geofence kullanımından bahsedeceğim. Cihaz belirli bir konuma girdiği zaman Push Kit kulanarak kullanıcıya bildirim yollayacağız.</p><p><strong>Geofence: </strong>Location Kit’in önemli özelliklerinden biridir. Geofence aslında coğrafi bir sanal sınır çizmek için kullanılır. Geofence hakkında daha detaylı bilgi için bu makaleye göz atabilirsiniz.</p><p><a href="https://medium.com/huawei-developers/using-the-geofence-service-of-huawei-location-kit-164cecd1e9a7">Using the Geofence Service of HUAWEI Location Kit</a></p><p><strong>Push Kit:</strong> Aslında bir mesajlaşma servisidir. İki farklı mesaj türü vardır. Bunlar notification ve data mesajlarıdır. Bu makalede mesaj türü olarak notification kullanacağız.</p><p>Geofence ve Push Kit servislerini kullanmak için önce gerekli kitleri projenize entegre etmelisiniz. Location ve Push Kit’i projenize kolayca entegre etmek için aşağıdaki dokümanı kullanabilirsiniz.</p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0">Preparations for Integrating HUAWEI HMS Core(Android)</a></p><p>HMS Core entegrasyonu bittikten sonra kullanıcının konumuna erişmek için kullandığımız izinleri AndroidManifest.xml dosyasına eklememiz gerekiyor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8800fb79916520a4c0db4fe397d7fe6e/href">https://medium.com/media/8800fb79916520a4c0db4fe397d7fe6e/href</a></iframe><p>Push Kit kullanarak cihaza bildirim göndermek için öncelikle cihazın bir push token alması gerekir.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b78acc6c1ec5c6a0c023fefbf0a87808/href">https://medium.com/media/b78acc6c1ec5c6a0c023fefbf0a87808/href</a></iframe><p>Bir push token aldık, şimdi access token elde etmemiz gerekiyor ve bunu servis aracılığı ile yapacağız. Bunun için Retrofit kullanmamız gerekiyor bu yüzden Retrofit kütüphanelerini app klasörünün altında bulunan build.gradle kısmına ekleyelim.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/975d960952382b1853f341b7c4bb9696/href">https://medium.com/media/975d960952382b1853f341b7c4bb9696/href</a></iframe><p>Access token’a erişmek için önce bir istek hazırlamalıyız. Bu istek grant_type, client_id, client_secret içermelidir ve AccessToken döndürür. Ardından bu AccessToken’ı başka istekler için kullanacağız. Şimdi Access Token elde edeceğimiz methoda bakalım. Bu method için Base URL’e ihtiyacımız var. OAUTH_BASE_URL olarak tanımlanan değişken Base URL’i temsil eder. Kendi projenizin değişkenlerine göre client_credentials, YOUR_CLIENT_ID, YOUR_CLIENT_SECRET kısımlarını doldurmayı unutmayınız. Burada kullanılan getAccessToken() Synchronous Call kullanarak oluşturuldu. Siz burada kendi projenizin ihtiyaçlarına göre Asynchronous Call kullanabilirsiniz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d12329a4e5ea372898334b5fe3799d64/href">https://medium.com/media/d12329a4e5ea372898334b5fe3799d64/href</a></iframe><p>Access token elde ettikten sonra push kit ile bildirim yollamak için bir Interface oluşturuyoruz. {YOUR_APP_ID} kısmını projenizin app ID’si ile doldurmayı unutmayınız.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba42d2ee35908983ec59f1bdc3f28556/href">https://medium.com/media/ba42d2ee35908983ec59f1bdc3f28556/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb2d708470f0a43c88f0634a6dc9eea0/href">https://medium.com/media/eb2d708470f0a43c88f0634a6dc9eea0/href</a></iframe><p>Bildirim göndermek için push kit işlemlerini tamamladık. Şimdi geofence için bu bildirimleri nasıl göndereceğimize bakalım. Önce geofence için bir BroadcastReceiver oluşturuyoruz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45d92b4518088f052358fb8f07024572/href">https://medium.com/media/45d92b4518088f052358fb8f07024572/href</a></iframe><p>BroadcastReceiver tetiklendiğinde geofence bilidirimlerimiz bu class üzerinden gönderilecek. Bu class içerisinde push kit için kullandığımız accessToken ve sendNotification methodlarını görebilirsiniz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/531be068014bf0a477e3acd8d8406cae/href">https://medium.com/media/531be068014bf0a477e3acd8d8406cae/href</a></iframe><p>Ardından geofence listesi oluşturmak için kullandığımız methodları ekliyoruz. Bu projede geofence tanımlamaları static olarak yapıldı. Bu geofence bilgilerini uygulamanızın ihtiyacına göre ayarlayabilirsiniz. Örneğin konum bilgileriniz veri tabanında tutuluyorsa veri tabanındaki geofence konumlarını kullanabilirsiniz. completeGeofenceList methodunda geofence eklerken unique id kısmına dikkat edin. Aynı id’lerle geofence eklemeye çalışırsanız hata alırsınız.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f0346f9dfa3e0996eee90fe1dc8c105/href">https://medium.com/media/1f0346f9dfa3e0996eee90fe1dc8c105/href</a></iframe><p>Geofence ile Push Kit kullanımı için oluşturulan örnek uygulama görüntüleri aşağıdaki gibidir;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*HJ_QaRyXXnM1lGjtzA4RGg.png" /></figure><p>Push Kit özelliklerini kullanarak bildirimleri uygulamanızın ihtiyaçlarına göre kişiselleştirebilirsiniz. Bu yazıda geofence bildirimleri için push kit kullanımının nasıl olacağını anlattım. Umarım beğenirsiniz . Okuduğunuz için teşekkürler. Herhangi bir sorunuz varsa yorum bırakabilir veya <a href="https://forums.developer.huawei.com/forumPortal/en/home">Huawei Developer Forum</a> aracılığıyla sorabilirsiniz.</p><p><strong>Kaynaklar</strong></p><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/geofence-develop-steps-0000001050986159-V5">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-introduction-0000001050040060">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34fb668ddca4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Geofence Notification with Push Kit]]></title>
            <link>https://medium.com/huawei-developers/geofence-notification-with-push-kit-19a9cf122a6c?source=rss-8336030b1cad------2</link>
            <guid isPermaLink="false">https://medium.com/p/19a9cf122a6c</guid>
            <category><![CDATA[geofence]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[huawei-push-kit]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <category><![CDATA[hms]]></category>
            <dc:creator><![CDATA[Damla Yagmur]]></dc:creator>
            <pubDate>Fri, 15 Jan 2021 06:58:13 GMT</pubDate>
            <atom:updated>2021-01-15T06:58:13.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*Hx9TiSP7CaHWgVzIfOYCbw.jpeg" /></figure><p>Hello everyone,<br>In this article, I will talk about how we can use together Geofence and Push Kit. When the device enters a set location, we will send a notification to the user using Push Kit.</p><p><strong>Geofence : </strong>It is an important feature in the Location Kit. Geofence is actually used to draw a geographic virtual boundary. For detailed information about geofence, you can check this article.</p><p><a href="https://medium.com/huawei-developers/using-the-geofence-service-of-huawei-location-kit-164cecd1e9a7">Using the Geofence Service of HUAWEI Location Kit</a></p><p><strong>Push Kit : </strong>Push kit is essentially a messaging service. There are two different message types. These are notification and data messages. We will use the notification messages in this article.</p><p>To use Geofence and Push kit services, you must first integrate the necessary kits into your project. You can use the document in the link to easily integrate the Location and Push kit into your project.</p><p><a href="https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0">Preparations for Integrating HUAWEI HMS Core(Android)</a></p><p>After the HMS Core integration is finished, we need to add permissions to the AndroidManifest.xml file in order to access the user’s location and internet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8800fb79916520a4c0db4fe397d7fe6e/href">https://medium.com/media/8800fb79916520a4c0db4fe397d7fe6e/href</a></iframe><p>To send a notification to the device using a push kit, firstly the device must receive a push token.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b78acc6c1ec5c6a0c023fefbf0a87808/href">https://medium.com/media/b78acc6c1ec5c6a0c023fefbf0a87808/href</a></iframe><p>We have received a push token, now we need to reach the access token, and we will do this through the service. We will obtain access token through the service, you must also complete the Retrofit implementations. Add Retrofit libraries app level build.gradle</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/975d960952382b1853f341b7c4bb9696/href">https://medium.com/media/975d960952382b1853f341b7c4bb9696/href</a></iframe><p>In order to send access token, first we should prepare our request. This request should have grant_type ,client_id ,client_secret and will return AccessToken. Then, we will use this AccessToken for out further requests.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ef76959e57513e7556d9840e2e1cb06/href">https://medium.com/media/3ef76959e57513e7556d9840e2e1cb06/href</a></iframe><p>Now let’s handle the method by which we will obtain the access token. We need a Base URL to use in this method. The variable defined as OAUTH_BASE_URL represents our base URL. Do not forget to fill in client_credentials, YOUR_CLIENT_ID, YOUR_CLIENT_SECRET parts according to your project. This getAccessToken() was created using Synchronous Call. You can do this with Asynchronous Call according to the needs of your own project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d12329a4e5ea372898334b5fe3799d64/href">https://medium.com/media/d12329a4e5ea372898334b5fe3799d64/href</a></iframe><p>After obtaining the access token, we create an interface to send a notification with the push kit. Do not forget to fill the {YOUR_APP_ID} part of your project app ID.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba42d2ee35908983ec59f1bdc3f28556/href">https://medium.com/media/ba42d2ee35908983ec59f1bdc3f28556/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb2d708470f0a43c88f0634a6dc9eea0/href">https://medium.com/media/eb2d708470f0a43c88f0634a6dc9eea0/href</a></iframe><p>We have set up the push kit to send notifications, now let’s see how we will send these notifications for geofence. First we create a broadcast receiver for geofence.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45d92b4518088f052358fb8f07024572/href">https://medium.com/media/45d92b4518088f052358fb8f07024572/href</a></iframe><p>When the Broadcast Receiver is triggered, our geofence notifications will be sent through this class. You can see the accessToken and sendNotification methods we use for push kit in this class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/531be068014bf0a477e3acd8d8406cae/href">https://medium.com/media/531be068014bf0a477e3acd8d8406cae/href</a></iframe><p>Then we add the methods we use to create a geofence list. In this project, I have defined geofences as static. You can adjust these geofence information according to the needs of your application. For example, if your location information is kept in the database, you can use geofence locations from the database. When adding geofences in the completeGeofenceList method, pay attention to the unique id part. If you try to add geofences with the same ids, you will get an error.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f0346f9dfa3e0996eee90fe1dc8c105/href">https://medium.com/media/1f0346f9dfa3e0996eee90fe1dc8c105/href</a></iframe><p>Sample application outputs for the use of push kit with geofence are as follows;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*HJ_QaRyXXnM1lGjtzA4RGg.png" /></figure><p>By using the push kit features, you can personalize your notifications according to the needs of your application. In this article I explained how to use the Push kit for Geofence notifications. I hope you will like it. Thank you for reading. If you have any questions, you can leave a comment or ask via <a href="https://forums.developer.huawei.com/forumPortal/en/home">Huawei Developer Forum</a>.</p><p><strong>References</strong></p><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/geofence-develop-steps-0000001050986159-V5">Document</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-introduction-0000001050040060">Document</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19a9cf122a6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/geofence-notification-with-push-kit-19a9cf122a6c">Geofence Notification with Push 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>