<?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 Zachary Powell on Medium]]></title>
        <description><![CDATA[Stories by Zachary Powell on Medium]]></description>
        <link>https://medium.com/@devwithzachary?source=rss-1f7727eda80------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GDpG2UtDEcHCiUo7uNQ0kA.jpeg</url>
            <title>Stories by Zachary Powell on Medium</title>
            <link>https://medium.com/@devwithzachary?source=rss-1f7727eda80------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:04:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devwithzachary/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[Sharing In-app Images with Huawei’s App Linking]]></title>
            <link>https://devwithzachary.medium.com/sharing-in-app-images-with-huaweis-app-linking-7fe76444147f?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fe76444147f</guid>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 14:28:46 GMT</pubDate>
            <atom:updated>2022-02-21T14:28:46.223Z</atom:updated>
            <content:encoded><![CDATA[<p>App Linking allows you to create links that work across multiple platforms including Android, iOS, and web. When an Android or iOS device user taps a link created with App Linking, they will be redirected to the specific in-app content. If a user has not yet installed the app, they will be redirected to their local app store to download the app. After downloading and opening the app, the user will be taken to the in-app content.</p><p>The following shows you how to share in-app images with App Linking.</p><h3>Service Setup</h3><p>To integrate the <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-getstarted-android-0000001054594767.">service</a>, perform the following steps:</p><ol><li>Create a project in AppGallery Connect.</li><li>Request a URL prefix.</li><li>Integrate the service SDK into your app and create a link using an API.</li><li>Configure your Android app to receive and process the link of App linking.</li></ol><p>To identify and load an image to be shared, you need to add the PhotoID parameter to the deep link of App Linking, and parse the deep link to obtain the parameter value when receiving the link.</p><h3>Creating a Project in AppGallery Connect</h3><ol><li>Sign in to AppGallery Connect and click My projects.</li><li>Click + to add a project on the displayed page. Enter a project name and click OK.</li><li>Add an app to the project, and configure the same package name as that set in your Android project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*Xq9xDvR9j5iQAx96.png" /></figure><h3>Requesting a URL Prefix</h3><ol><li>Go to <strong>Grow</strong> &gt; <strong>App Linking</strong>.</li><li>On the <strong>App Linking</strong> page, click <strong>Use now</strong> to enable the service.</li><li>Under the <strong>URL prefixes</strong> tab page, click <strong>New URL prefix</strong> to add a unique URL prefix. AppGallery Connect automatically checks whether the URL prefix is unique.<br>In this example, the URL prefix is configured as follows.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*fcaCoMujjh9znPs6.png" /></figure><h3>Integrating the Service SDK and Creating a Link Using an API</h3><p>Go to Project setting &gt; General information, download the agconnect-service.json file and add it to the App directory of your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*zJRCFN8nZ7Vd7VuP.png" /></figure><p>Open the project-level <strong>gradle</strong> file, and add the Maven repository address and AppGallery Connect plugin to the file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c80476c921ac3b85e015765330ca2cb4/href">https://medium.com/media/c80476c921ac3b85e015765330ca2cb4/href</a></iframe><p>Apply the AppGallery Connect plugin in the app-level gradle file, and add the service SDK to the file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18bbd4e2cf381f816bb41f4dfd6c0e41/href">https://medium.com/media/18bbd4e2cf381f816bb41f4dfd6c0e41/href</a></iframe><p>Call an API to create a link of App Linking based on the photo ID.<br>Define the <strong>UserName</strong> and <strong>ImageURL</strong> input parameters for the preview page of the deep link, and encapsulate the <strong>PhotoID</strong> parameter into the deep link.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57fd501d4d1e57d3da7339a887d5ee16/href">https://medium.com/media/57fd501d4d1e57d3da7339a887d5ee16/href</a></iframe><h3>Receiving a Link of App Linking</h3><p>First of all, create an activity on the ImageDetail page for receiving the deep link of App Linking, to which a user will be redirected after the link is tapped.</p><p>Add an intent filter for receiving the deep link to <strong>ImageDetailActivity</strong> in the <strong>AndroidManifest</strong> file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7df773d127b3759c5b83baa8dd864413/href">https://medium.com/media/7df773d127b3759c5b83baa8dd864413/href</a></iframe><p>Under onCreate() of the ImageDetail file, add the following code for receiving and parsing a link of App Linking, and for obtaining the data of the deep link.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88e2bdcaf3b2def364d0929d674bc452/href">https://medium.com/media/88e2bdcaf3b2def364d0929d674bc452/href</a></iframe><h3>Additional Configurations</h3><p>If a user has not installed your app, perform the following operations:</p><p>If a user has not installed your app, they will be redirected to the app details page on AppGallery or another local app store, to download your app, based on the app package name of your app.</p><p>When the user downloads and launches your app, the link of App Linking can still take effect and parameter values can be passed. However, the user will be redirected to the home page upon the first launch your app, as the intent filter configured in the last step does not take effect. Therefore, you need to configure the home screen for receiving the link of App Linking.</p><p>So for example set an activity for getAppLinking, for example, LoginActivity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6950684e3e4ee4419f375f2f4721e7b3/href">https://medium.com/media/6950684e3e4ee4419f375f2f4721e7b3/href</a></iframe><p>References</p><p><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction-0000001054143215">Service introduction of App Linking</a><br><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-getstarted-android-0000001054594767.">Get Started tutorials</a><br><a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-faqvideo-0000001189403609">App Linking Videos: Troubleshooting</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fe76444147f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common errors found when generating Android certificates (and how to fix them!)]]></title>
            <link>https://devwithzachary.medium.com/common-errors-found-when-generating-android-certificates-and-how-to-fix-them-a687afcd5b4f?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/a687afcd5b4f</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Tue, 15 Feb 2022 11:37:51 GMT</pubDate>
            <atom:updated>2022-02-15T11:37:51.144Z</atom:updated>
            <content:encoded><![CDATA[<p>AppGallery supports two kinds of signing certificates: one that is totally generated by AppGallery Connect and the other one that is generated by developers. Here I will share some solutions with you for the common errors reported during the signing certificate generation.<br>The command in the <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appsigning-introduction-0000001051379577">official document</a> is as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9e70414911be752090dc0a7697266ee/href">https://medium.com/media/a9e70414911be752090dc0a7697266ee/href</a></iframe><h3>Error 1 — “No value provided for flag: include-cer”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*ezV9LzqzIRbAo0u-.png" /></figure><p>Cause: It is not the correct <strong>pepk.jar</strong> file. Normally, its file size is around 2 MB. Check whether it is the file that was provided by Android Studio.<br>Solution: Use the correct <strong>pepk.jar</strong> file that you can get from <a href="https://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk.jar">Google</a>.</p><h3>Error 2: “java.io.IOException: Keystore was tampered with, or password was incorrect”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*qFaMtVoPGbKnbPbY.png" /></figure><p>Cause: The keystore password is most likely not correct.<br>Solution: Enter the correct password.</p><h3>Error 3: “Unable to export or encrypt the private key”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*yvHlfscViA_qm_ax.png" /></figure><p>Cause: Incorrect password. The keystore password is entered correctly, but the key file password is entered incorrectly when entered for the second time.<br>Solution: Enter the correct <strong>key</strong> file password.</p><h3>Error 4: “Unable to parse the input:”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*QwStK26RYwDZ0xhO.png" /></figure><p>Cause: The length of the encryption key is incorrect. Check whether you have copied the complete encryption key.<br>Solution: Use the complete encryption key.</p><h3>Error 5: “java.lang.IllegalArgumentException: publicKey should be 68 bytes”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*r70LZifXz72Ipqes.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*_KT6jT9Gs3E6uPsY.png" /></figure><p>Cause: The length of the encryption key is incorrect. Check whether you have copied the complete encryption key.<br>Solution: Use the complete encryption key.</p><h3>Error 6: “java.lang.IllegalArgumentException: Hex encoded byte array must have even length but instead has length: 143.”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*h0ktsnjdJt2s7g0T.png" /></figure><p>Cause: The encryption key is too long.<br>Solution: Use the correct encryption key</p><h3>Error 7: “java.security.GeneralSecurityException: point is not on the curve”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*BuBd3dEC5ZdZBXC6.png" /></figure><p>Cause: The encryption key is incorrect.<br>Solution: Use the correct encryption key.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a687afcd5b4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Huawei App Messaging in Android]]></title>
            <link>https://devwithzachary.medium.com/using-huawei-app-messaging-in-android-28e0607d67c7?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/28e0607d67c7</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 15:11:43 GMT</pubDate>
            <atom:updated>2022-02-10T15:11:43.042Z</atom:updated>
            <content:encoded><![CDATA[<p>Huawei AppGallery Connect’s App Messaging service allows you to send targeted, useful in app messages to your users.<br>The look and content of messages are completely customisable, and there is a wide range of triggers and filters that can be used to decide who will receive a message and when.<br>Lets take a look today at how we can set this up to work within an Android project.</p><p>As always we will start with a fresh project but of course you can just as easily use this guide to build the service into an app you already have!</p><h3>Enabling the Service</h3><p>Sign in to AppGallery Connect, click <strong>My projects</strong>, click your project, go to <strong>Grow &gt; App Messaging</strong>, and click Use now. For more information, please refer to <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718">App Messaging</a>.<br>If you do not have an Android project, create one first.<br>After completing these steps, you can start creating an in-app message.</p><p>Click <strong>New</strong> in the upper right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*GQIa_vhMR8sYNtOZ.png" /></figure><p>Set <strong>Name</strong> and <strong>Description</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*02nlmmWoCucJjWCx.png" /></figure><p>Set the style and content and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*JMorbLS3a1CZYbDN.png" /></figure><p>Select a message type from the Layout drop-down list, and set its style and content. Currently, the Modal, Image, and Banner message types are supported.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*uJ-Crl7l-ULEjVQ6.png" /></figure><p>Set target users and click Next.</p><p>In App, select the name of the app package for which you need to publish the in-app message.</p><p>You can click New condition to add a condition for matching target users, which include app version, OS version, language, country/region, audience, and more. Among the types, User attributes are defined under HUAWEI Analytics &gt; Management &gt; User attributes, and Prediction is defined by creating prediction tasks under My projects &gt; Grow &gt; Prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*m94MGcqp1hYpOEJk.png" /></figure><p>Set the message sending time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*SrVuT5pMEmvEW9zb.png" /></figure><p>Message display is triggered by specific events. App Messaging supports two types of <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-create-android-0000001072054882">trigger events</a>: preset events and HUAWEI Analytics events.<br>(Optional) Set conversion events. Before setting a conversion event, you need to toggle it on first, which can be done as follows:<br>Go to HUAWEI Analytics &gt; Management &gt; Events and toggle Mark as conversion event and Event switch on for the specified event. In addition to the events the SDK collects, you can also create a preset or custom event for event tracking and analysis.</p><p>Finally, Click Save or Publish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*tOwGQoUbKRWKwyD5.png" /></figure><h3>Integrating the Service SDK</h3><p>Add Maven repository configuration to the build.gradle file of your project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcc349868d1e33c292ce4ce20c462877/href">https://medium.com/media/fcc349868d1e33c292ce4ce20c462877/href</a></iframe><p>Open the app-level build.gradle file and configure the App Messaging SDK</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4110c25556ddc940627a2397a01915f5/href">https://medium.com/media/4110c25556ddc940627a2397a01915f5/href</a></iframe><p>In AppGallery Connect, click My projects, and find your project from the list. Go to Project settings &gt; General information, download the agconnect-services.json file, and save the file to the app directory of your Android project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/0*oZfCnxRpskD_Jk7d.png" /></figure><h3>Displaying an In-App Message</h3><p>If you choose to display a message using the default message layout, the development process is totally coding-free.<br>By integrating the SDK as above you are all good to go, your creating message will be displayed as per its filters and triggers.<br>You can also call APIs provided by the service SDK to customize your in-app message.</p><h3>Customising the Message Layout</h3><p>First, you need to customize a message display class. To do so, implement AGConnectAppMessagingDisplay and override the displayMessage method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1b35a1bc12a14dcfa79805768eb1224/href">https://medium.com/media/f1b35a1bc12a14dcfa79805768eb1224/href</a></iframe><p>Define an AlertDialog in displayMessage and copy the layout file to the code. The sample code is as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55700f45c1dcf6f99756a1a02fffaf70/href">https://medium.com/media/55700f45c1dcf6f99756a1a02fffaf70/href</a></iframe><p>Call addCustomView to implement the custom layout.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/461d0914da98513a769867055e2b5f6d/href">https://medium.com/media/461d0914da98513a769867055e2b5f6d/href</a></iframe><h3>Test in app message</h3><p>Obtain the Anonymous Application Identifier (AAID) of your test device, which is used to identify app instances running on mobile devices during app installation. Compared with device-level hardware IDs that cannot be reset, the privacy of AAID is much higher. We can obtain the AAID through coding.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3576429652956466fe08097d6fecc955/href">https://medium.com/media/3576429652956466fe08097d6fecc955/href</a></iframe><p>Sign in to AppGallery Connect, go to Grow &gt; App Messaging &gt; Messages, find the message that you need to test, and click Test in the Operation column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*UY7xqA6nikFbXQ2i.png" /></figure><p>Click Add test user and enter the AAID in the test box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*EuHffuM8xfR7Nfdp.png" /></figure><p>Click Save. Check whether the test message can be properly displayed and operated.</p><p>For details, please refer to the development guide of <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718">App Messaging</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28e0607d67c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Huawei AppGallery Remote Configuration in your Xamarin Android app]]></title>
            <link>https://devwithzachary.medium.com/implement-huawei-appgallery-remote-configuration-in-your-xamarin-android-app-500159e99767?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/500159e99767</guid>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Tue, 08 Feb 2022 10:43:00 GMT</pubDate>
            <atom:updated>2022-02-08T10:43:00.599Z</atom:updated>
            <content:encoded><![CDATA[<p>Xamarin (Microsoft) is a multi-system development platform for mobile services that many developers use. Many AppGallery Connect services now support Xamarin, including Remote Configuration.</p><p>Remote Config allows you to make changes to your app remotely by making use of variables that you can define in the AppGallery Console. Different values can be set for different audiences, locations or sections of users. This is a great way to personalise your application, carry out testing of new features or just make updates without having to deploy a new app version.</p><h3>Install the Xamarin environment and project setup.</h3><p>You’ll need to first download and install Visual Studio 2019.<br>Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/0*-kk91xYQyEWVV3BM.png" /></figure><p>Next make sure you have enabled the <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922">Auth Service</a> in AppGallery Connect.</p><p>Open Visual Studio, click Create a new project in the start window, select Mobile App (Xamarin.Forms), and set the app name and other required information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*R69SrjWtwpMug_kJ.png" /></figure><p>Right-click your project and choose <strong>Manage NuGet Packages</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*XP4khasni_FrmKG9.png" /></figure><p>Search for the <strong>Huawei.Agconnect.RemoteConfiguration</strong> package on the displayed page and install it.</p><p>Download the JSON service file from your AppGallery project and add it into the *<em>Assets</em> directory in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*9lG94fD8G92MlmHu.png" /></figure><p>Create a new class named <strong>HmsLazyInputStreams.cs</strong>, and implement the following code to read the JSON file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d238f5fc33dcdea4bd47ee10f75ab3b5/href">https://medium.com/media/d238f5fc33dcdea4bd47ee10f75ab3b5/href</a></iframe><p>Create a ContentProvider class and add the following code for your file to be read once your app is launched. Ensure that the package name set in ContentProvider, and the one in your project and the one set in AppGallery Connect are the same as the app package name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/faade4ce621562a2b011c54222fc1d46/href">https://medium.com/media/faade4ce621562a2b011c54222fc1d46/href</a></iframe><p>Right-click your project and choose <strong>Properties</strong>. Click <strong>Android Manifest</strong> on the displayed page and set a package name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*qbsdUQ1kCgISlSHg.png" /></figure><h3>Set in app default parameter values</h3><p>You can configure a default parameter value in either of the following ways:<br>Using an XML resource file. Add a default parameter value XML file to the res/xml directory of your project. Call the <strong>ApplyDefault</strong> method to read the file.</p><p>Or you can use a Map object. Set a default parameter value dynamically through coding.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc67ec3ce9cba3b42c9f69a7aa84f978/href">https://medium.com/media/bc67ec3ce9cba3b42c9f69a7aa84f978/href</a></iframe><h3>Fetch the updated parameter value</h3><p>Call the fetch API to fetch the updated parameter value from Remote Configuration. The default update interval used by the fetch API is 12 hours and can be set as required.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/578c15eaf57981004ff0c55eb43d6ec7/href">https://medium.com/media/578c15eaf57981004ff0c55eb43d6ec7/href</a></iframe><h3>Obtain all parameter values</h3><p>For Xamarin.Android apps, the MergedAll API is called to obtain all parameter values including the in-app default parameter value and the on-cloud parameter value. For Android apps, the getMergedAll API is used</p><p>And that’s all for integrating Remote Configuration into Xamarin.Android apps. As more and more AppGallery Connect services support Xamarin, I will keep you posted about further integration tutorials.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=500159e99767" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Huawei AppGallery Auth Service in your Xamarin Android app with Facebook Login support]]></title>
            <link>https://devwithzachary.medium.com/implement-huawei-appgallery-auth-service-in-your-xamarin-android-app-with-facebook-login-support-a2c56eb211cf?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2c56eb211cf</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 14:53:55 GMT</pubDate>
            <atom:updated>2022-02-03T14:53:55.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Xamarin (Microsoft) is a multi-system development platform for mobile services that many developers use. Many AppGallery Connect services now support Xamarin, including Auth Service. Here I’ll explain on how to integrate Auth Service into your Xamarin.Android app and use the 3rd party auth support for Facebook.</p><h3>Install the Xamarin environment and project setup.</h3><p>You’ll need to first download and install Visual Studio 2019.<br>Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/0*sAvOHgWy1qpoQB8Z.png" /></figure><p>Next make sure you have enabled the <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922">Auth Service</a> in AppGallery Connect.</p><p>Open Visual Studio, click Create a new project in the start window, select Mobile App (Xamarin.Forms), and set the app name and other required information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*5VgDPylZQhg_efxP.png" /></figure><p>Right-click your project and choose <strong>Manage NuGet Packages</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*RUSJ8vqYvgxb6OxP.png" /></figure><p>Search for the <strong>Huawei.Agconnect.Auth</strong> package on the displayed page and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*E4Cm31sMsDTG-BXF.png" /></figure><p>Download the JSON service file from your AppGallery project and add it into the *<em>Assets</em> directory in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*qiE59Gx7pnx9ej-7.png" /></figure><p>Create a new class named <strong>HmsLazyInputStreams.cs</strong>, and implement the following code to read the JSON file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d238f5fc33dcdea4bd47ee10f75ab3b5/href">https://medium.com/media/d238f5fc33dcdea4bd47ee10f75ab3b5/href</a></iframe><p>Right-click your project and choose <strong>Properties</strong>. Click <strong>Android Manifest</strong> on the displayed page and set a package name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*NRQrwI1KQKpr56a7.png" /></figure><p>Follow the process that Facebook describes to setup your application with their platform. Details can be found <a href="https://developers.facebook.com/docs/facebook-login/android">here</a></p><p>Finally the last thing we need to do is install the Xamarin Facebook login package.</p><p>Right-click your project and choose <strong>Manage NuGet Packages</strong>. Search for <strong>Xamarin.Facebook.Login.Android</strong> and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/0*d3W2vEbGyabfX5XU.png" /></figure><h3>Implement Facebook Auth</h3><p>Create a login button within your application, this will use the below code to start the login process getting the specific requested account details from Facebook and process this using the call back.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea47173cf08a5f2b98af6a37b20e76fc/href">https://medium.com/media/ea47173cf08a5f2b98af6a37b20e76fc/href</a></iframe><p>The Facebook Callback then looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/665ccab9477fad3f5a1f1ec14b9be214/href">https://medium.com/media/665ccab9477fad3f5a1f1ec14b9be214/href</a></iframe><p>In the <strong>OnSuccess</strong> method, we have obtained the access token and generated a credential for Facebook Login, and called <strong>SignInAsync</strong> to pass the credential for sign-in.</p><p>Finally, forward <strong>OnActivityResult</strong> to the <strong>callBackManager</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6c053a819909cf05201f91f40502459/href">https://medium.com/media/f6c053a819909cf05201f91f40502459/href</a></iframe><p>The result code <strong>64206</strong> is defined by Facebook in its Login SDK. It is used to identify the callback for Facebook Login when there are multiple callbacks in <strong>OnActivityResult</strong>. An interesting fact is that, the hexadecimal value of 64206 is 0xFACE, which is a little trick from Facebook.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2c56eb211cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Huawei App Messaging in Flutter]]></title>
            <link>https://devwithzachary.medium.com/using-huawei-app-messaging-in-flutter-802b41be6791?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/802b41be6791</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Tue, 01 Feb 2022 10:32:57 GMT</pubDate>
            <atom:updated>2022-02-01T10:32:57.779Z</atom:updated>
            <content:encoded><![CDATA[<p>Huawei AppGallery Connect’s App Messaging service allows you to send targeted, useful in-app messages to your users.<br>The look and content of messages are completely customisable, and there is a wide range of triggers and filters that can be used to decide who will receive a message and when.<br>Let&#39;s take a look today at how we can set this up to work within a flutter project.</p><p>As always we will start with a fresh project but of course, you can just as easily use this guide to build the service into an app you already have!</p><h3>Installing the Flutter Environment</h3><ol><li><a href="https://docs.flutter.dev/get-started/install/windows">Download the Flutter SDK</a>.</li><li>Decompress the package to any directory.</li><li>Add the Flutter command file to the environment variable.</li><li>Download the Flutter and Dart plugins in Android Studio.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*JUapaTjp5LsRE5_1.png" /></figure><h3>Enabling the Service and Creating a Flutter project</h3><p>Sign in to AppGallery Connect, click <strong>My projects</strong>, click your project, go to <strong>Grow &gt; App Messaging</strong>, and click Use now. For more information, please refer to <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718">App Messaging</a>.<br>If you do not have an Android project, create one first.<br>After completing these steps, you can start creating an in-app message.</p><p>Click <strong>New</strong> in the upper right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*eAw3c8z0aqu1Fga8.png" /></figure><p>Set <strong>Name</strong> and <strong>Description</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*gyyCKb0gyEgKeuEq.png" /></figure><p>Set the style and content and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*etllxK_n1KYq2BGa.png" /></figure><p>Select a message type from the Layout drop-down list, and set its style and content. Currently, the Modal, Image, and Banner message types are supported.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*nUjXBYjowr7nLWJM.png" /></figure><p>Set target users and click Next.</p><p>In App, select the name of the app package for which you need to publish the in-app message.</p><p>You can click New condition to add a condition for matching target users, which include app version, OS version, language, country/region, audience, and more. Among the types, User attributes are defined under HUAWEI Analytics &gt; Management &gt; User attributes, and Prediction is defined by creating prediction tasks under My projects &gt; Grow &gt; Prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*QF6rxfr2p7OLqEPN.png" /></figure><p>Set the message sending time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*B53YFsZ1LxELxmaJ.png" /></figure><p>Message display is triggered by specific events. App Messaging supports two types of <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-create-android-0000001072054882">trigger events</a>: preset events and HUAWEI Analytics events.<br>(Optional) Set conversion events. Before setting a conversion event, you need to toggle it on first, which can be done as follows:<br>Go to HUAWEI Analytics &gt; Management &gt; Events and toggle Mark as conversion event and Event switch on for the specified event. In addition to the events the SDK collects, you can also create a preset or custom event for event tracking and analysis.</p><p>Finally, Click Save or Publish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*fGyD2Aa1BaipVVfP.png" /></figure><h3>Integrating the Service SDK</h3><h3>Add dependencies</h3><p>Start by creating a Flutter project in Android Studio (or opening one).<br>Then add the <strong>agconnect-services.json</strong> file from your AppGallery project to the android/app directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/0*NKRYEuQgjOoeW0TJ.png" /></figure><p>Within the project level <strong>build.gradle</strong> file make sure to include the huawei maven repo and add the agcp package as a dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e7f0f95540f73b275f76acd6475a94a/href">https://medium.com/media/8e7f0f95540f73b275f76acd6475a94a/href</a></iframe><p>Next in your app level <strong>build.gradle</strong> apply the agconnect plugin as so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adfdc24b48f02d3efc72484b8c9084a1/href">https://medium.com/media/adfdc24b48f02d3efc72484b8c9084a1/href</a></iframe><p>Then in your <strong>pubspec.yaml</strong> file add the App Messaging SDK dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/401b4c1aac5223b222dbb2c04f407622/href">https://medium.com/media/401b4c1aac5223b222dbb2c04f407622/href</a></iframe><h3>Displaying an In-App Message</h3><p>If you choose to display a message using the default message layout, the development process is totally coding-free.<br>By integrating the SDK as above you are all good to go, your creating message will be displayed as per its filters and triggers.<br>You can also call APIs provided by the service SDK to customize your in-app message.</p><h3>Customising the Message Layout</h3><p>Add the following code to onCreate in MainActivity,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/881cc71e92240880ec828cf099a9628e/href">https://medium.com/media/881cc71e92240880ec828cf099a9628e/href</a></iframe><p>so that the service SDK can listen to the corresponding event and apply the customized layout.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18392428abab6defdfedd7d524a74017/href">https://medium.com/media/18392428abab6defdfedd7d524a74017/href</a></iframe><p>Then the message is displayed in your app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e0888dcd9925968191f215b4fcb5d91/href">https://medium.com/media/3e0888dcd9925968191f215b4fcb5d91/href</a></iframe><h3>Testing an In-App Message</h3><p>App Messaging allows you to test an in-app message before it is published. You need to obtain the Anonymous Application Identifier (AAID) of your test device by adding the following code to your Android app module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8832ee7de18a70539595766cbe4d16bf/href">https://medium.com/media/8832ee7de18a70539595766cbe4d16bf/href</a></iframe><p>Sign in to AppGallery Connect, go to <strong>Grow &gt; App Messaging &gt; Messages</strong>, find the message that you created, click and select <strong>Test</strong> in the <strong>Operation</strong> column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*SGThTapoMj-Sftge.png" /></figure><p>Click Add test user and enter the AAID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*LuSqEprjzjdIIzgi.png" /></figure><p>Click Save. Check whether the test message is properly displayed on your test device</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=802b41be6791" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Huawei’s Remote Configuration into an Android App]]></title>
            <link>https://devwithzachary.medium.com/integrating-huaweis-remote-configuration-into-an-android-app-43db5d87d657?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/43db5d87d657</guid>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Wed, 26 Jan 2022 13:51:32 GMT</pubDate>
            <atom:updated>2022-01-26T13:51:32.917Z</atom:updated>
            <content:encoded><![CDATA[<p>Remote Configuration allows you to change how your app works and looks on the cloud, without requiring any app upgrades. Here we’ll take a look at a hands-on example of how to integrate Remote Configuration.</p><h3>Enabling and Configuring Remote Configuration</h3><p>Sign in to AppGallery Connect and click <strong>My projects</strong>.<br>Click your project card and select the app for which you want to enable Remote Configuration from the app drop-down list on the top.<br>Go to <strong>Grow &gt; Remote Configuration</strong>. If this is your first time using Remote Configuration, click <strong>Use now</strong> in the upper right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*UCEB1MNWoo5SCaah.png" /></figure><p>Then you’ll be able to configure the service in AppGallery Connect.<br>On the <strong>Remote Configuration</strong> page, set parameter and their conditions.<br>First, click New parameter to add a parameter. You can set multiple conditional values for a parameter. That is, the parameter value will vary depending on the condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*evuUUpUxKz8deHR3.png" /></figure><p>Click <strong>Save</strong>.<br>Click <strong>Release</strong> to make the configuration take effect. If you click <strong>Cancel</strong>, all changes will be discarded.<br>Click the <strong>Parameters</strong> tab, on which all parameters are listed.<br>Click in the upper right corner of the parameter card. You’ll be able to view, modify, and delete parameters, and copy existing parameters as new ones.<br>On the <strong>Conditions</strong> tab, you can <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-android-cloudconfig-0000001056587179">set different conditions</a> for the parameter. For example, if you set <strong>Condition</strong> to <strong>Audience</strong>, the configured parameter value will be updated only for a specific user group.</p><h3>Integrating SDKs</h3><p>Add Maven repository configuration to the <strong>build.gradle</strong> file of your project</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70241279d6e09368c93c7c70f03dc1ba/href">https://medium.com/media/70241279d6e09368c93c7c70f03dc1ba/href</a></iframe><p>Open the app-level <strong>build.gradle</strong> file, and configure the Remote Configuration SDK, Analytics SDK, and AppGallery Connect Plugin</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98c3fb4112d14910a97935b41e67dda0/href">https://medium.com/media/98c3fb4112d14910a97935b41e67dda0/href</a></iframe><p>In AppGallery Connect, click <strong>My projects</strong>, and find your project from the list. Go to <strong>Project settings</strong> &gt; <strong>General information</strong>, download the <strong>agconnect-services.json</strong> file, and save the file to the app directory of your Android project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/0*lU2_hMKsSb99vGlY.png" /></figure><h3>Developing Functions</h3><p>In this step, the Remote Configuration SDK will be used to set in-app default values and fetch parameter values from the cloud.<br>Add a default value configuration XML file, for example, <strong>remote_config.xml</strong>, to the <strong>res/xml</strong> directory of your Android Studio project. In the file, key-value pairs are in testvalue format.</p><p>Call <strong>applyDefault</strong> to pass the default values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8171b629a36410b2149010eb4a9b6524/href">https://medium.com/media/8171b629a36410b2149010eb4a9b6524/href</a></iframe><p>You can also create a <strong>Map</strong> object, and call applyDefault to read and pass the default values.</p><p>You can apply parameter values fetched from the cloud either immediately or upon the next launch of your app.</p><h3>Fetch parameter values and apply them immediately</h3><p>The following code applies parameter values immediately.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/731a897d4ae4f1dba0106e7744488425/href">https://medium.com/media/731a897d4ae4f1dba0106e7744488425/href</a></iframe><p>In the code, call the fetch API to fetch parameter values from the cloud, and then call the apply API to apply the parameter values in the fetching callback immediately.</p><h3>Fetch parameter values and apply them upon the next launch of your app.</h3><p>The following code applies parameter values upon the next launch of your app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a79f013da0b1f73cd051fb17de933b5/href">https://medium.com/media/8a79f013da0b1f73cd051fb17de933b5/href</a></iframe><p>In the code, call loadLastFetched to obtain the parameter values fetched by calling the fetch API, and call the apply API to apply the parameter values.</p><h3>Obtain the value for a single parameter</h3><p>You can call an API to obtain the value for a parameter of a specific type from parameter values fetched from the cloud. The APIs for different parameter types are listed below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e0ab551c3b33d7e27983971fa1e2f4e/href">https://medium.com/media/6e0ab551c3b33d7e27983971fa1e2f4e/href</a></iframe><h3>Obtain all parameter values</h3><p>You can obtain all in-app default parameter values and on-cloud parameter values by calling getMergedAll.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3176297f8300bf08d30a2781aadfaefe/href">https://medium.com/media/3176297f8300bf08d30a2781aadfaefe/href</a></iframe><p>For details, please refer to the development guide for <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-introduction-0000001055149778">Remote Configuration</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43db5d87d657" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix app crashing when using the showFloatWindow API on Huawei devices running EMUI before…]]></title>
            <link>https://devwithzachary.medium.com/how-to-fix-app-crashing-when-using-the-showfloatwindow-api-on-huawei-devices-running-emui-before-7c738b41b69f?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c738b41b69f</guid>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Thu, 20 Jan 2022 11:24:15 GMT</pubDate>
            <atom:updated>2022-01-20T11:24:15.234Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to fix app crashing when using the showFloatWindow API on Huawei devices running EMUI before version 9.1</h3><p>A number of reports were received about crashes when the showFloatWindow API is called on devices running older versions of EMUI. Let&#39;s take a look at this crash today and how we can fix the issue.</p><p>Start by integrating version 6.1.0.301 of the Game Service SDK into a project and successfully implemented the <a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/game-buoy-0000001050121528">floating window function</a>.<br>Then, when testing the game on devices running a version of EMUI earlier than 9.1, the game crashed when showFloatWindow API is called. The crash logs are as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*CQ5j9t-td12d-1Um.png" /></figure><p>The error logs suggested that the issue was caused by missing layout files during layout implementation. This error suggests that c_buoycircle_window_small.xml, c_buoycircle_hide_notice.xml, and c_buoycircle_hide_guide_dialog.xml layout files were not found in this project. However, they had been saved under the layout folder as displayed in the following figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/0*ngjlj_206KOJcqTA.png" /></figure><p>The next possible issue could have been that the layout files were obfuscated. So, let&#39;s check the build file to be sure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*Bed_sINscCVcmzzH.png" /></figure><p>As you can see minifyEnabled was set to true, indicating that the obfuscation function was enabled. This was also the case for shrinkResources, which meant that resource files were excluded during package creation.</p><p>One option of course would be to simply disable the shrinking of resources. By commenting out this line the game would run fine and the API call wouldn’t crash, however, the resource files are no longer compressed and will take up much more space.</p><p>To compress the resources, you can create an XML file that contains the resources tag in the project or use the keep.xml file in the res/raw directory, and specify the resources to be reserved in the tools:keep attribute as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/355fc9f348f4fc8af3c479634cbc690f/href">https://medium.com/media/355fc9f348f4fc8af3c479634cbc690f/href</a></iframe><p>This solution allows the floating window function to work and is able to compress the resource files.</p><p>Note: If you have integrated the Game Service SDK, Huawei suggests that you add the following resources and configure the following obfuscation scripts.</p><p>@drawable/c_buoycircle*<br>@drawable/hms_game*<br>@layout/c_buoycircle*<br>@layout/hms_game*<br>@strings/hms_game*<br>@strings/c_buoycircle*</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c738b41b69f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Cloud Functions in a Flutter application]]></title>
            <link>https://devwithzachary.medium.com/integrating-cloud-functions-in-a-flutter-application-b93ca4e4fe60?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/b93ca4e4fe60</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Wed, 19 Jan 2022 17:09:16 GMT</pubDate>
            <atom:updated>2022-01-19T17:09:16.221Z</atom:updated>
            <content:encoded><![CDATA[<p>Cloud Functions enables serverless computing through Function as a Service (FaaS) capabilities to simplify app development and O&amp;M. This helps you implement functions more simply and build service capabilities more quickly. The following describes how to integrate Huawei’s AppGallery Connect Cloud Function service in Flutter.<br>We will create a basic new project as an example but of course, you could make use of a project you already have that&#39;s using flutter!</p><h3>Project Setup</h3><h3>Install the Flutter environment.</h3><p>Download the <a href="https://flutter.dev/docs/get-started/install/windows">Flutter SDK package</a> and decompress the package to any directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*jCxSOUrQc7b8ggZm.png" /></figure><p>Download the Flutter and Dart plugins in Android Studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*x3bfy97YRLy5xPKe.png" /></figure><h3>Enable Huawei Cloud Functions</h3><p>Create an Android app in AppGallery Connect and enable Cloud Functions for it as detailed in this <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-getstarted-0000001059119572">guide</a>.<br>Now we can go ahead and create a cloud function as you require it to use this <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-config-0000001058511532">guide</a> to help understand what can be done.<br>Once you are happy with your function (in this instance it might just be as simple as returning a hello world statement for testing) you can go ahead and create a <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-httptrigger-0000001126992899">HTTP trigger</a> that will trigger the function.</p><h3>Create Flutter Project</h3><p>Next create your flutter project in android studio (or open your existing project if you already have one!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*4Y7tSApXGeRjomaC.png" /></figure><p>Download your <strong>agconnect-services.json</strong> file from the AppGallery Connect console and add it to your project under the ‘app’ directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*FJqv9Y7nsumfq654.png" /></figure><p>Within the project-level <strong>build.gradle</strong> file make sure to include the Huawei maven repo and add the agcp package as a dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e7f0f95540f73b275f76acd6475a94a/href">https://medium.com/media/8e7f0f95540f73b275f76acd6475a94a/href</a></iframe><p>Next in your app level <strong>build.gradle</strong> apply the agconnect plugin as so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adfdc24b48f02d3efc72484b8c9084a1/href">https://medium.com/media/adfdc24b48f02d3efc72484b8c9084a1/href</a></iframe><p>Then in your <strong>pubspec.yaml</strong> file add the Cloud Function SDK dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f1898aa815d9c505d04aea05f965201/href">https://medium.com/media/2f1898aa815d9c505d04aea05f965201/href</a></iframe><h3>Call the Cloud function</h3><p>The below code is an example of how you can call a simple cloud function and get the result returned.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcadbaf0810408ea1c1826693cb87edf/href">https://medium.com/media/dcadbaf0810408ea1c1826693cb87edf/href</a></iframe><p>Where test-\$latest is the HTTP trigger identifier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b93ca4e4fe60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Auth Service into a Xamarin Android App]]></title>
            <link>https://devwithzachary.medium.com/integrating-auth-service-into-a-xamarin-android-app-411647d26206?source=rss-1f7727eda80------2</link>
            <guid isPermaLink="false">https://medium.com/p/411647d26206</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[appgallery-connect]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[huawei]]></category>
            <dc:creator><![CDATA[Zachary Powell]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 14:09:00 GMT</pubDate>
            <atom:updated>2022-01-10T14:09:00.914Z</atom:updated>
            <content:encoded><![CDATA[<p>Xamarin (Microsoft) is a multi-system development platform for mobile services that many developers use. Many AppGallery Connect services now support Xamarin, including Auth Service. Here I’ll explain on how to integrate Auth Service into your Xamarin.Android app that requires mobile number sign-in support.</p><h3>Install the Xamarin environment.</h3><p>You’ll need to first download and install Visual Studio 2019.<br>Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/0*pHV6wLjV7JXH2Hvh.png" /></figure><p>Next make sure you have enabled the <a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922">Auth Service</a> in AppGallery Connect.</p><p>Open Visual Studio, click Create a new project in the start window, select Mobile App (Xamarin.Forms), and set the app name and other required information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*DQTchcLoa2bS9rNV.png" /></figure><p>Right-click your project and choose <strong>Manage NuGet Packages</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*L0lU8-SnC6bY5deC.png" /></figure><p>Search for the <strong>Huawei.Agconnect.Auth</strong> package on the displayed page and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*2SWdmXJ67qCcJQ7N.png" /></figure><p>Download the JSON service file from your AppGallery project and add it into the *<em>Assets</em> directory in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*elyWBysAlihoV5pd.png" /></figure><p>Create a new class named <strong>HmsLazyInputStreams.cs</strong>, and implement the following code to read the JSON file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8ddd76b369f9b63471ab262c189afda/href">https://medium.com/media/c8ddd76b369f9b63471ab262c189afda/href</a></iframe><p>Then add the following code to <strong>AttachBaseContext</strong> under <strong>MainActivity</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ef7d44d1a8a1d3c38fa5bb5dbc57d13/href">https://medium.com/media/5ef7d44d1a8a1d3c38fa5bb5dbc57d13/href</a></iframe><p>Right-click your project and choose Properties. Click Android Manifest on the displayed page, and set a package name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*CDIomap0x7nvlcmn.png" /></figure><p>Once you’ve completed all of these preparations, you’ll be able to develop app functions.</p><p>If your app requires mobile number sign-in support, the Auth Service SDK can help you implement both sign-up and sign-in for this authentication mode. You’ll need to send verification codes to your users for both stages. Auth Service can help you with that as well.</p><h3>Setup Mobile Number verification</h3><p>Create a VerifyCodeSettings object that contains the SMS messaging settings, including the action and language.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa8cf6cdc4b524e1f317ab4eb96ddd33/href">https://medium.com/media/fa8cf6cdc4b524e1f317ab4eb96ddd33/href</a></iframe><p>Call the <strong>RequestVerifyCodeAsync</strong> method to send a request to the Auth Service server, and pass the country code and mobile number entered by a user, and the <strong>VerifyCodeSettings</strong> object you just created, for Auth Service to send a verification code SMS message to the user.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37236b88db7e9a98c27acadd0071e55e/href">https://medium.com/media/37236b88db7e9a98c27acadd0071e55e/href</a></iframe><p>Upon receiving the verification code, the user can start sign-up.<br>First, you’ll need to create a PhoneUser object to store the user’s inputs, including the mobile number, country code, verification code, and password. The user can choose whether to set a password. If so, they’ll need to enter a password when signing in to your app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e6c9ab5492bf5af05d92dfc9c337538/href">https://medium.com/media/8e6c9ab5492bf5af05d92dfc9c337538/href</a></iframe><p>Call the <strong>CreateUserAsync</strong> method to create a user.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ed59d6922e3ebdfdf13244539fac66c/href">https://medium.com/media/5ed59d6922e3ebdfdf13244539fac66c/href</a></iframe><p>Once sign-up is complete, the Auth Service SDK will automatically sign the user in to your app, and you won’t need to call the sign-in API again.</p><p>For an existing user, you need to implement the sign-in process, either via a verification code or a password.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e18d2f7d12782596417c4bd14db31d6/href">https://medium.com/media/4e18d2f7d12782596417c4bd14db31d6/href</a></iframe><p>You can call CredentialwithPassword or CredentialWithVerifyCode to generate a credential for a password sign-in or a verification code sign-in, respectively. Then call the SignInAsync method to pass the credential for sign-in.</p><p>And thats it! We now have a fully functional authentication system using the users mobile number to confirm they are who they say they are.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=411647d26206" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>