<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zachary Powell</title>
    <description>The latest articles on DEV Community by Zachary Powell (@devwithzachary).</description>
    <link>https://dev.to/devwithzachary</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F506918%2F52a7bac6-9f92-4cbd-a577-35d950db17cc.jpeg</url>
      <title>DEV Community: Zachary Powell</title>
      <link>https://dev.to/devwithzachary</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devwithzachary"/>
    <language>en</language>
    <item>
      <title>Sharing In-app Images with Huawei's App Linking</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Mon, 21 Feb 2022 14:18:12 +0000</pubDate>
      <link>https://dev.to/devwithzachary/sharing-in-app-images-with-huaweis-app-linking-248l</link>
      <guid>https://dev.to/devwithzachary/sharing-in-app-images-with-huaweis-app-linking-248l</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;The following shows you how to share in-app images with App Linking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Setup
&lt;/h2&gt;

&lt;p&gt;To integrate the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-getstarted-android-0000001054594767."&gt;service&lt;/a&gt;, perform the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Create a project in AppGallery Connect.&lt;/li&gt;
&lt;li&gt; Request a URL prefix.&lt;/li&gt;
&lt;li&gt; Integrate the service SDK into your app and create a link using an API.&lt;/li&gt;
&lt;li&gt; Configure your Android app to receive and process the link of App linking.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Project in AppGallery Connect
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign in to AppGallery Connect and click My projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click + to add a project on the displayed page. Enter a project name and click OK.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add an app to the project, and configure the same package name as that set in your Android project.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h3&gt;
  
  
  Requesting a URL Prefix
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;strong&gt;Grow&lt;/strong&gt; &amp;gt; &lt;strong&gt;App Linking&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the &lt;strong&gt;App Linking&lt;/strong&gt; page, click &lt;strong&gt;Use now&lt;/strong&gt; to enable the service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under the &lt;strong&gt;URL prefixes&lt;/strong&gt; tab page, click &lt;strong&gt;New URL prefix&lt;/strong&gt; to add a unique URL prefix. AppGallery Connect automatically checks whether the URL prefix is unique.&lt;br&gt;
In this example, the URL prefix is configured as follows.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h3&gt;
  
  
  Integrating the Service SDK and Creating a Link Using an API
&lt;/h3&gt;

&lt;p&gt;Go to Project setting &amp;gt; General information, download the agconnect-service.json file and add it to the App directory of your project.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35wigutorilokh2abeeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35wigutorilokh2abeeg.png" alt="Image description" width="629" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the project-level &lt;strong&gt;gradle&lt;/strong&gt; file, and add the Maven repository address and AppGallery Connect plugin to the file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Apply the AppGallery Connect plugin in the app-level gradle file, and add the service SDK to the file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Call an API to create a link of App Linking based on the photo ID.&lt;br&gt;
Define the &lt;strong&gt;UserName&lt;/strong&gt; and &lt;strong&gt;ImageURL&lt;/strong&gt; input parameters for the preview page of the deep link, and encapsulate the &lt;strong&gt;PhotoID&lt;/strong&gt; parameter into the deep link.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Receiving a Link of App Linking
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Add an intent filter for receiving the deep link to &lt;strong&gt;ImageDetailActivity&lt;/strong&gt; in the &lt;strong&gt;AndroidManifest&lt;/strong&gt; file&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Additional Configurations
&lt;/h2&gt;

&lt;p&gt;If a user has not installed your app, perform the following operations:&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;So for example set an activity for getAppLinking, for example, LoginActivity.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;References&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction-0000001054143215"&gt;Service introduction of App Linking&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-getstarted-android-0000001054594767."&gt;Get Started tutorials&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-faqvideo-0000001189403609"&gt;App Linking Videos: Troubleshooting&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>huawei</category>
      <category>appgallery</category>
    </item>
    <item>
      <title>Common errors found when generating Android certificates (and how to fix them!)</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Tue, 15 Feb 2022 11:31:21 +0000</pubDate>
      <link>https://dev.to/devwithzachary/common-errors-found-when-generating-android-certificates-and-how-to-fix-them-3iem</link>
      <guid>https://dev.to/devwithzachary/common-errors-found-when-generating-android-certificates-and-how-to-fix-them-3iem</guid>
      <description>&lt;p&gt;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.&lt;br&gt;
The command in the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appsigning-introduction-0000001051379577" rel="noopener noreferrer"&gt;official document&lt;/a&gt; is as follows:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Error 1 - "No value provided for flag: include-cer"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1eheb0iclw6zhjjrkoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1eheb0iclw6zhjjrkoz.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: It is not the correct &lt;strong&gt;pepk.jar&lt;/strong&gt; file. Normally, its file size is around 2 MB. Check whether it is the file that was provided by Android Studio.&lt;br&gt;
Solution: Use the correct &lt;strong&gt;pepk.jar&lt;/strong&gt; file that you can get from &lt;a href="https://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk.jar" rel="noopener noreferrer"&gt;Google&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error 2: "java.io.IOException: Keystore was tampered with, or password was incorrect"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zcmwajzi4klv2ax9c33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zcmwajzi4klv2ax9c33.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: The keystore password is most likely not correct.&lt;br&gt;
Solution: Enter the correct password.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error 3: "Unable to export or encrypt the private key"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yv8j8nvqhdrojdsv6fo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yv8j8nvqhdrojdsv6fo.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: Incorrect password. The keystore password is entered correctly, but the key file password is entered incorrectly when entered for the second time.&lt;br&gt;
Solution: Enter the correct &lt;strong&gt;key&lt;/strong&gt; file password. &lt;/p&gt;

&lt;h2&gt;
  
  
  Error 4: "Unable to parse the input:"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkgfyhkc6pdk3cja3ce3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkgfyhkc6pdk3cja3ce3.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: The length of the encryption key is incorrect. Check whether you have copied the complete encryption key.&lt;br&gt;
Solution: Use the complete encryption key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error 5: "java.lang.IllegalArgumentException: publicKey should be 68 bytes"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdt1yt2zg6drnfgodvau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdt1yt2zg6drnfgodvau.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiecxcvh231mrdnag4ra9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiecxcvh231mrdnag4ra9.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: The length of the encryption key is incorrect. Check whether you have copied the complete encryption key.&lt;br&gt;
Solution: Use the complete encryption key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error 6: "java.lang.IllegalArgumentException: Hex encoded byte array must have even length but instead has length: 143."
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2ppgnc0jp7kt54cffy5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2ppgnc0jp7kt54cffy5.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: The encryption key is too long.&lt;br&gt;
Solution: Use the correct encryption key&lt;/p&gt;

&lt;h2&gt;
  
  
  Error 7: "java.security.GeneralSecurityException: point is not on the curve"
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhesbyndq5enqenuqts4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhesbyndq5enqenuqts4.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Cause: The encryption key is incorrect.&lt;br&gt;
Solution: Use the correct encryption key.&lt;/p&gt;

</description>
      <category>android</category>
      <category>appgallery</category>
      <category>huawei</category>
    </item>
    <item>
      <title>Using Huawei App Messaging in Android</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Thu, 10 Feb 2022 15:01:46 +0000</pubDate>
      <link>https://dev.to/devwithzachary/using-huawei-app-messaging-in-android-2053</link>
      <guid>https://dev.to/devwithzachary/using-huawei-app-messaging-in-android-2053</guid>
      <description>&lt;p&gt;Huawei AppGallery Connect's App Messaging service allows you to send targeted, useful in app messages to your users. &lt;br&gt;
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.&lt;br&gt;
Lets take a look today at how we can set this up to work within an Android project.&lt;/p&gt;

&lt;p&gt;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!&lt;/p&gt;
&lt;h2&gt;
  
  
  Enabling the Service
&lt;/h2&gt;

&lt;p&gt;Sign in to AppGallery Connect, click &lt;strong&gt;My projects&lt;/strong&gt;, click your project, go to &lt;strong&gt;Grow &amp;gt; App Messaging&lt;/strong&gt;, and click Use now. For more information, please refer to &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718"&gt;App Messaging&lt;/a&gt;.&lt;br&gt;
If you do not have an Android project, create one first.&lt;br&gt;
After completing these steps, you can start creating an in-app message.&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;New&lt;/strong&gt; in the upper right corner.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b3jpegx24drmi3yqp2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b3jpegx24drmi3yqp2s.png" alt="Image description" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set &lt;strong&gt;Name&lt;/strong&gt; and &lt;strong&gt;Description&lt;/strong&gt; &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliz3d1i7rlfs5owrqpjq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliz3d1i7rlfs5owrqpjq.png" alt="Image description" width="800" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the style and content and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fds0pf7wcbh29hd47cehe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fds0pf7wcbh29hd47cehe.png" alt="Image description" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhci52rf3ajioxo7r5iq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhci52rf3ajioxo7r5iq6.png" alt="Image description" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set target users and click Next.&lt;/p&gt;

&lt;p&gt;In App, select the name of the app package for which you need to publish the in-app message.&lt;/p&gt;

&lt;p&gt;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 &amp;gt; Management &amp;gt; User attributes, and Prediction is defined by creating prediction tasks under My projects &amp;gt; Grow &amp;gt; Prediction.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6652um0hiv7ezkb03wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6652um0hiv7ezkb03wc.png" alt="Image description" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the message sending time&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewwyinui587x0ufryhlj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewwyinui587x0ufryhlj.png" alt="Image description" width="800" height="481"&gt;&lt;/a&gt;&lt;br&gt;
Message display is triggered by specific events. App Messaging supports two types of &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-create-android-0000001072054882"&gt;trigger events&lt;/a&gt;: preset events and HUAWEI Analytics events. &lt;br&gt;
(Optional) Set conversion events. Before setting a conversion event, you need to toggle it on first, which can be done as follows:&lt;br&gt;
Go to HUAWEI Analytics &amp;gt; Management &amp;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.&lt;/p&gt;

&lt;p&gt;Finally, Click Save or Publish.&lt;/p&gt;

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

&lt;p&gt;Add Maven repository configuration to the build.gradle file of your project.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Open the app-level build.gradle file and configure the App Messaging SDK&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In AppGallery Connect, click My projects, and find your project from the list. Go to Project settings &amp;gt; General information, download the agconnect-services.json file, and save the file to the app directory of your Android project.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Displaying an In-App Message
&lt;/h2&gt;

&lt;p&gt;If you choose to display a message using the default message layout, the development process is totally coding-free. &lt;br&gt;
By integrating the SDK as above you are all good to go, your creating message will be displayed as per its filters and triggers.&lt;br&gt;
You can also call APIs provided by the service SDK to customize your in-app message.&lt;/p&gt;
&lt;h3&gt;
  
  
  Customising the Message Layout
&lt;/h3&gt;

&lt;p&gt;First, you need to customize a message display class. To do so, implement AGConnectAppMessagingDisplay and override the displayMessage method.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Define an AlertDialog in displayMessage and copy the layout file to the code. The sample code is as follows:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Call addCustomView to implement the custom layout.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Test in app message
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Sign in to AppGallery Connect, go to Grow &amp;gt; App Messaging &amp;gt; Messages, find the message that you need to test, and click Test in the Operation column.&lt;/p&gt;

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

&lt;p&gt;Click Add test user and enter the AAID in the test box.&lt;/p&gt;

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

&lt;p&gt;Click Save. Check whether the test message can be properly displayed and operated. &lt;/p&gt;

&lt;p&gt;For details, please refer to the development guide of &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718"&gt;App Messaging&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>android</category>
      <category>java</category>
      <category>huawei</category>
      <category>appgallery</category>
    </item>
    <item>
      <title>Implement Huawei AppGallery Remote Configuration in your Xamarin Android app</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Tue, 08 Feb 2022 10:32:53 +0000</pubDate>
      <link>https://dev.to/devwithzachary/implement-huawei-appgallery-remote-configuration-in-your-xamarin-android-app-2bl7</link>
      <guid>https://dev.to/devwithzachary/implement-huawei-appgallery-remote-configuration-in-your-xamarin-android-app-2bl7</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install the Xamarin environment and project setup.
&lt;/h2&gt;

&lt;p&gt;You'll need to first download and install Visual Studio 2019.&lt;br&gt;
Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" alt="Visual Studios install screen" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next make sure you have enabled the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922"&gt;Auth Service&lt;/a&gt; in AppGallery Connect.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" alt="Visual Studio create new project screen" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right-click your project and choose &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" alt="Right click menu with Manage NuGet Packages highlighted" width="459" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for the &lt;strong&gt;Huawei.Agconnect.RemoteConfiguration&lt;/strong&gt; package on the displayed page and install it.&lt;/p&gt;

&lt;p&gt;Download the JSON service file from your AppGallery project and add it into the *&lt;em&gt;Assets&lt;/em&gt; directory in your project.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" alt="Xamarin file structure showing agconnect-service.json file in Asserts folder" width="528" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new class named &lt;strong&gt;HmsLazyInputStreams.cs&lt;/strong&gt;, and implement the following code to read the JSON file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Right-click your project and choose &lt;strong&gt;Properties&lt;/strong&gt;. Click &lt;strong&gt;Android Manifest&lt;/strong&gt; on the displayed page and set a package name&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg9isq4chiow0qt3t7qp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg9isq4chiow0qt3t7qp.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Set in app default parameter values
&lt;/h2&gt;

&lt;p&gt;You can configure a default parameter value in either of the following ways:&lt;br&gt;
Using an XML resource file. Add a default parameter value XML file to the res/xml directory of your project. Call the &lt;strong&gt;ApplyDefault&lt;/strong&gt; method to read the file.&lt;/p&gt;

&lt;p&gt;Or you can use a Map object. Set a default parameter value dynamically through coding.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Fetch the updated parameter value
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Obtain all parameter values
&lt;/h2&gt;

&lt;p&gt;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&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

</description>
      <category>xamarin</category>
      <category>android</category>
      <category>huawei</category>
      <category>appgallery</category>
    </item>
    <item>
      <title>Implement Huawei AppGallery Auth Service in your Xamarin Android app with Facebook Login support</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Thu, 03 Feb 2022 14:45:30 +0000</pubDate>
      <link>https://dev.to/devwithzachary/implement-huawei-appgallery-auth-service-in-your-xamarin-android-app-with-facebook-login-support-2iod</link>
      <guid>https://dev.to/devwithzachary/implement-huawei-appgallery-auth-service-in-your-xamarin-android-app-with-facebook-login-support-2iod</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install the Xamarin environment and project setup.
&lt;/h2&gt;

&lt;p&gt;You'll need to first download and install Visual Studio 2019.&lt;br&gt;
Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" alt="Visual Studios install screen" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next make sure you have enabled the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922"&gt;Auth Service&lt;/a&gt; in AppGallery Connect.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" alt="Visual Studio create new project screen" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right-click your project and choose &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" alt="Right click menu with Manage NuGet Packages highlighted" width="459" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for the &lt;strong&gt;Huawei.Agconnect.Auth&lt;/strong&gt; package on the displayed page and install it.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr5ft4ny5pr3o2pd9jqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr5ft4ny5pr3o2pd9jqr.png" alt="NuGet search result for Huawei.Agconnect.Auth" width="800" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download the JSON service file from your AppGallery project and add it into the *&lt;em&gt;Assets&lt;/em&gt; directory in your project.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" alt="Xamarin file structure showing agconnect-service.json file in Asserts folder" width="528" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new class named &lt;strong&gt;HmsLazyInputStreams.cs&lt;/strong&gt;, and implement the following code to read the JSON file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Right-click your project and choose &lt;strong&gt;Properties&lt;/strong&gt;. Click &lt;strong&gt;Android Manifest&lt;/strong&gt; on the displayed page and set a package name&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg9isq4chiow0qt3t7qp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg9isq4chiow0qt3t7qp.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the process that Facebook describes to setup your application with their platform. Details can be found &lt;a href="https://developers.facebook.com/docs/facebook-login/android"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Finally the last thing we need to do is install the Xamarin Facebook login package. &lt;/p&gt;

&lt;p&gt;Right-click your project and choose &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;. Search for &lt;strong&gt;Xamarin.Facebook.Login.Android&lt;/strong&gt; and install it.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F796z7128hynzk9wkourl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F796z7128hynzk9wkourl.png" alt="Image description" width="554" height="44"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Implement Facebook Auth
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The Facebook Callback then looks like:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the &lt;strong&gt;OnSuccess&lt;/strong&gt; method, we have obtained the access token and generated a credential for Facebook Login, and called &lt;strong&gt;SignInAsync&lt;/strong&gt; to pass the credential for sign-in.&lt;/p&gt;

&lt;p&gt;Finally, forward &lt;strong&gt;OnActivityResult&lt;/strong&gt; to the &lt;strong&gt;callBackManager&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The result code &lt;strong&gt;64206&lt;/strong&gt; is defined by Facebook in its Login SDK. It is used to identify the callback for Facebook Login when there are multiple callbacks in &lt;strong&gt;OnActivityResult&lt;/strong&gt;. An interesting fact is that, the hexadecimal value of 64206 is 0xFACE, which is a little trick from Facebook.&lt;/p&gt;

</description>
      <category>android</category>
      <category>xamarin</category>
      <category>huawei</category>
      <category>facebook</category>
    </item>
    <item>
      <title>Using Huawei App Messaging in Flutter</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Tue, 01 Feb 2022 10:27:51 +0000</pubDate>
      <link>https://dev.to/devwithzachary/using-huawei-app-messaging-in-flutter-3kom</link>
      <guid>https://dev.to/devwithzachary/using-huawei-app-messaging-in-flutter-3kom</guid>
      <description>&lt;p&gt;Huawei AppGallery Connect's App Messaging service allows you to send targeted, useful in app messages to your users. &lt;br&gt;
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.&lt;br&gt;
Lets take a look today at how we can set this up to work within a flutter project.&lt;/p&gt;

&lt;p&gt;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!&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing the Flutter Environment
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;a href="https://docs.flutter.dev/get-started/install/windows" rel="noopener noreferrer"&gt;Download the Flutter SDK&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; Decompress the package to any directory.&lt;/li&gt;
&lt;li&gt; Add the Flutter command file to the environment variable.&lt;/li&gt;
&lt;li&gt; Download the Flutter and Dart plugins in Android Studio.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg75ecvyyk8a86rg1hg0n.png" alt="Image description"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Enabling the Service and Creating a Flutter project
&lt;/h2&gt;

&lt;p&gt;Sign in to AppGallery Connect, click &lt;strong&gt;My projects&lt;/strong&gt;, click your project, go to &lt;strong&gt;Grow &amp;gt; App Messaging&lt;/strong&gt;, and click Use now. For more information, please refer to &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-getstarted-android-0000001072532718" rel="noopener noreferrer"&gt;App Messaging&lt;/a&gt;.&lt;br&gt;
If you do not have an Android project, create one first.&lt;br&gt;
After completing these steps, you can start creating an in-app message.&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;New&lt;/strong&gt; in the upper right corner.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b3jpegx24drmi3yqp2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b3jpegx24drmi3yqp2s.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Set the style and content and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fds0pf7wcbh29hd47cehe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fds0pf7wcbh29hd47cehe.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhci52rf3ajioxo7r5iq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhci52rf3ajioxo7r5iq6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set target users and click Next.&lt;/p&gt;

&lt;p&gt;In App, select the name of the app package for which you need to publish the in-app message.&lt;/p&gt;

&lt;p&gt;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 &amp;gt; Management &amp;gt; User attributes, and Prediction is defined by creating prediction tasks under My projects &amp;gt; Grow &amp;gt; Prediction.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6652um0hiv7ezkb03wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6652um0hiv7ezkb03wc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the message sending time&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewwyinui587x0ufryhlj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewwyinui587x0ufryhlj.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Message display is triggered by specific events. App Messaging supports two types of &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-create-android-0000001072054882" rel="noopener noreferrer"&gt;trigger events&lt;/a&gt;: preset events and HUAWEI Analytics events. &lt;br&gt;
(Optional) Set conversion events. Before setting a conversion event, you need to toggle it on first, which can be done as follows:&lt;br&gt;
Go to HUAWEI Analytics &amp;gt; Management &amp;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.&lt;/p&gt;

&lt;p&gt;Finally, Click Save or Publish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9shx8mh58b1n0huswazc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9shx8mh58b1n0huswazc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Integrating the Service SDK
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Add dependencies
&lt;/h3&gt;

&lt;p&gt;Start by creating a Flutter project in Android Studio (or opening one).&lt;br&gt;
Then add the &lt;strong&gt;agconnect-services.json&lt;/strong&gt; file from your AppGallery project to the android/app directory&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48r1aw16xxrershg8fhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48r1aw16xxrershg8fhf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within the project level &lt;strong&gt;build.gradle&lt;/strong&gt; file make sure to include the huawei maven repo and add the agcp package as a dependency.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Next in your app level &lt;strong&gt;build.gradle&lt;/strong&gt; apply the agconnect plugin as so:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Then in your &lt;strong&gt;pubspec.yaml&lt;/strong&gt; file add the App Messaging SDK dependency. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Displaying an In-App Message
&lt;/h3&gt;

&lt;p&gt;If you choose to display a message using the default message layout, the development process is totally coding-free. &lt;br&gt;
By integrating the SDK as above you are all good to go, your creating message will be displayed as per its filters and triggers.&lt;br&gt;
You can also call APIs provided by the service SDK to customize your in-app message.&lt;/p&gt;
&lt;h3&gt;
  
  
  Customising the Message Layout
&lt;/h3&gt;

&lt;p&gt;Add the following code to onCreate in MainActivity,&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
so that the service SDK can listen to the corresponding event and apply the customized layout.


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Then the message is displayed in your app.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Testing an In-App Message
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Sign in to AppGallery Connect, go to &lt;strong&gt;Grow &amp;gt; App Messaging &amp;gt; Messages&lt;/strong&gt;, find the message that you created, click   and select &lt;strong&gt;Test&lt;/strong&gt; in the &lt;strong&gt;Operation&lt;/strong&gt; column.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ne7921ydhen16laetv5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ne7921ydhen16laetv5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Add test user and enter the AAID&lt;/p&gt;

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

&lt;p&gt;Click Save. Check whether the test message is properly displayed on your test device&lt;/p&gt;

</description>
      <category>android</category>
      <category>flutter</category>
      <category>huawei</category>
      <category>appgallery</category>
    </item>
    <item>
      <title>Integrating Huawei's Remote Configuration into an Android App</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Wed, 26 Jan 2022 13:47:11 +0000</pubDate>
      <link>https://dev.to/devwithzachary/integrating-huaweis-remote-configuration-into-an-android-app-4j62</link>
      <guid>https://dev.to/devwithzachary/integrating-huaweis-remote-configuration-into-an-android-app-4j62</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enabling and Configuring Remote Configuration
&lt;/h2&gt;

&lt;p&gt;Sign in to AppGallery Connect and click &lt;strong&gt;My projects&lt;/strong&gt;.&lt;br&gt;
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.&lt;br&gt;
Go to &lt;strong&gt;Grow &amp;gt; Remote Configuration&lt;/strong&gt;. If this is your first time using Remote Configuration, click &lt;strong&gt;Use now&lt;/strong&gt; in the upper right corner.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuefslax0lk59y1g9234k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuefslax0lk59y1g9234k.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Then you'll be able to configure the service in AppGallery Connect.&lt;br&gt;
On the &lt;strong&gt;Remote Configuration&lt;/strong&gt; page, set parameter and their conditions.&lt;br&gt;
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.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yq68ulnie4rvk0uxrak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yq68ulnie4rvk0uxrak.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;br&gt;
Click &lt;strong&gt;Release&lt;/strong&gt; to make the configuration take effect. If you click &lt;strong&gt;Cancel&lt;/strong&gt;, all changes will be discarded.&lt;br&gt;
Click the &lt;strong&gt;Parameters&lt;/strong&gt; tab, on which all parameters are listed.&lt;br&gt;
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.&lt;br&gt;
On the &lt;strong&gt;Conditions&lt;/strong&gt; tab, you can &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-android-cloudconfig-0000001056587179" rel="noopener noreferrer"&gt;set different conditions&lt;/a&gt; for the parameter. For example, if you set &lt;strong&gt;Condition&lt;/strong&gt; to &lt;strong&gt;Audience&lt;/strong&gt;, the configured parameter value will be updated only for a specific user group. &lt;/p&gt;
&lt;h2&gt;
  
  
  Integrating SDKs
&lt;/h2&gt;

&lt;p&gt;Add Maven repository configuration to the &lt;strong&gt;build.gradle&lt;/strong&gt; file of your project&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Open the app-level &lt;strong&gt;build.gradle&lt;/strong&gt; file, and configure the Remote Configuration SDK, Analytics SDK, and AppGallery Connect Plugin&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In AppGallery Connect, click &lt;strong&gt;My projects&lt;/strong&gt;, and find your project from the list. Go to &lt;strong&gt;Project settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;General information&lt;/strong&gt;, download the &lt;strong&gt;agconnect-services.json&lt;/strong&gt; file, and save the file to the app directory of your Android project.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Developing Functions
&lt;/h2&gt;

&lt;p&gt;In this step, the Remote Configuration SDK will be used to set in-app default values and fetch parameter values from the cloud.&lt;br&gt;
Add a default value configuration XML file, for example, &lt;strong&gt;remote_config.xml&lt;/strong&gt;, to the &lt;strong&gt;res/xml&lt;/strong&gt; directory of your Android Studio project. In the file, key-value pairs are in testvalue format.&lt;/p&gt;

&lt;p&gt;Call &lt;strong&gt;applyDefault&lt;/strong&gt; to pass the default values.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
You can also create a &lt;strong&gt;Map&lt;/strong&gt; object, and call applyDefault to read and pass the default values.

&lt;p&gt;You can apply parameter values fetched from the cloud either immediately or upon the next launch of your app. &lt;/p&gt;
&lt;h3&gt;
  
  
  Fetch parameter values and apply them immediately
&lt;/h3&gt;

&lt;p&gt;The following code applies parameter values immediately.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fetch parameter values and apply them upon the next launch of your app.
&lt;/h3&gt;

&lt;p&gt;The following code applies parameter values upon the next launch of your app.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Obtain the value for a single parameter
&lt;/h3&gt;

&lt;p&gt;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&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Obtain all parameter values
&lt;/h3&gt;

&lt;p&gt;You can obtain all in-app default parameter values and on-cloud parameter values by calling getMergedAll.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;For details, please refer to the development guide for &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-introduction-0000001055149778" rel="noopener noreferrer"&gt;Remote Configuration&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>huawei</category>
      <category>android</category>
    </item>
    <item>
      <title>How to fix app crashing when using the showFloatWindow API on Huawei devices running EMUI before version 9.1</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Thu, 20 Jan 2022 11:22:29 +0000</pubDate>
      <link>https://dev.to/devwithzachary/how-to-fix-app-crashing-when-using-the-showfloatwindow-api-on-huawei-devices-running-emui-before-version-91-4pg4</link>
      <guid>https://dev.to/devwithzachary/how-to-fix-app-crashing-when-using-the-showfloatwindow-api-on-huawei-devices-running-emui-before-version-91-4pg4</guid>
      <description>&lt;p&gt;A number of reports where received about crashes when the showFloatWindow API is called on devices running older versions of EMUI. Lets take a look at this crash today and how we can fix the issue.&lt;/p&gt;

&lt;p&gt;Start by integrating version 6.1.0.301 of the Game Service SDK into a project and successfully implemented the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/game-buoy-0000001050121528"&gt;floating window function&lt;/a&gt;. &lt;br&gt;
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.&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;

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

&lt;p&gt;The next possible issue could have been that the layout files were obfuscated. So, lets check the build file to be sure:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flgpnoznpf0q1h007kl89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flgpnoznpf0q1h007kl89.png" alt="Image description" width="522" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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. &lt;/p&gt;

&lt;p&gt;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 not longer compressed and will take up much more space.&lt;/p&gt;

&lt;p&gt;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:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This solution allows the floating window function to work and is able to compress the resource files.&lt;/p&gt;

&lt;p&gt;Note: If you have integrated the Game Service SDK, Huawei suggests that you add the following resources and configure the following obfuscation scripts.&lt;/p&gt;

&lt;p&gt;@drawable/c_buoycircle*&lt;br&gt;
@drawable/hms_game*&lt;br&gt;
@layout/c_buoycircle*&lt;br&gt;
@layout/hms_game*&lt;br&gt;
@strings/hms_game*&lt;br&gt;
@strings/c_buoycircle*&lt;/p&gt;

</description>
      <category>huawei</category>
      <category>android</category>
    </item>
    <item>
      <title>Integrating Cloud Functions in a Flutter application</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Wed, 19 Jan 2022 16:54:57 +0000</pubDate>
      <link>https://dev.to/devwithzachary/integrating-cloud-functions-in-a-flutter-application-268</link>
      <guid>https://dev.to/devwithzachary/integrating-cloud-functions-in-a-flutter-application-268</guid>
      <description>&lt;p&gt;Cloud Functions enables serverless computing through Function as a Service (FaaS) capabilities to simplify app development and O&amp;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. &lt;br&gt;
We will create a basic new project as an example but of course you could make use of a project you already have thats using flutter!&lt;/p&gt;
&lt;h2&gt;
  
  
  Project Setup
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Install the Flutter environment.
&lt;/h3&gt;

&lt;p&gt;Download the &lt;a href="https://flutter.dev/docs/get-started/install/windows"&gt;Flutter SDK package&lt;/a&gt; and decompress the package to any directory.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcw1yfftv3tf57dnnjs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcw1yfftv3tf57dnnjs1.png" alt="Image description" width="800" height="262"&gt;&lt;/a&gt;&lt;br&gt;
Download the Flutter and Dart plugins in Android Studio.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdzrnlc5sq4nqu35hnv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdzrnlc5sq4nqu35hnv2.png" alt="Image description" width="800" height="574"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Enable Huawei Cloud Functions
&lt;/h3&gt;

&lt;p&gt;Create an Android app in AppGallery Connect and enable Cloud Functions for it as detailed in this &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-getstarted-0000001059119572"&gt;guide&lt;/a&gt;. &lt;br&gt;
Now we can go ahead and create a cloud function as you require it use this &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-config-0000001058511532"&gt;guide&lt;/a&gt; to help understand what can be done. &lt;br&gt;
Once your 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 &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-httptrigger-0000001126992899"&gt;HTTP trigger&lt;/a&gt; that will trigger the function.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create Flutter Project
&lt;/h3&gt;

&lt;p&gt;Next create your flutter project in android studio (or open your existing project if you already have one!).&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faiwn6dm3fpa82lnnjkme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faiwn6dm3fpa82lnnjkme.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;br&gt;
Download your &lt;strong&gt;agconnect-services.json&lt;/strong&gt; file from the AppGallery Connect console and add it into your project under the 'app' directory &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F08zhwhcymklq1mo1k66n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F08zhwhcymklq1mo1k66n.png" alt="Image description" width="727" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within the project level &lt;strong&gt;build.gradle&lt;/strong&gt; file make sure to include the huawei maven repo and add the agcp package as a dependency.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Next in your app level &lt;strong&gt;build.gradle&lt;/strong&gt; apply the agconnect plugin as so:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Then in your &lt;strong&gt;pubspec.yaml&lt;/strong&gt; file add the Cloud Function SDK dependency. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Call the Cloud function
&lt;/h3&gt;

&lt;p&gt;The below code is an example of how you can call a simple cloud function and get the result returned. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Where test-\$latest is the HTTP trigger identifier.&lt;/p&gt;

</description>
      <category>huawei</category>
      <category>flutter</category>
      <category>android</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Integrating Auth Service into a Xamarin Android App</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Mon, 10 Jan 2022 13:52:44 +0000</pubDate>
      <link>https://dev.to/devwithzachary/integrating-auth-service-into-a-xamarin-android-app-a1i</link>
      <guid>https://dev.to/devwithzachary/integrating-auth-service-into-a-xamarin-android-app-a1i</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install the Xamarin environment.
&lt;/h2&gt;

&lt;p&gt;You'll need to first download and install Visual Studio 2019.&lt;br&gt;
Open Visual Studio and select Mobile development with .NET to install the Xamarin environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9oknn2l1tkpohgllnje.png" alt="Visual Studios install screen" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next make sure you have enabled the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-auth-android-getstarted-0000001053053922"&gt;Auth Service&lt;/a&gt; in AppGallery Connect.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoffdg2w5i54hpru8bmy.png" alt="Visual Studio create new project screen" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right-click your project and choose &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5tx9wcmxwx5s1jzca0vc.png" alt="Right click menu with Manage NuGet Packages highlighted" width="459" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for the &lt;strong&gt;Huawei.Agconnect.Auth&lt;/strong&gt; package on the displayed page and install it.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr5ft4ny5pr3o2pd9jqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr5ft4ny5pr3o2pd9jqr.png" alt="NuGet search result for Huawei.Agconnect.Auth" width="800" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download the JSON service file from your AppGallery project and add it into the *&lt;em&gt;Assets&lt;/em&gt; directory in your project.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpbvccmjn60i3u9usrpy.png" alt="Xamarin file structure showing agconnect-service.json file in Asserts folder" width="528" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new class named &lt;strong&gt;HmsLazyInputStreams.cs&lt;/strong&gt;, and implement the following code to read the JSON file.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Then add the following code to &lt;strong&gt;AttachBaseContext&lt;/strong&gt; under &lt;strong&gt;MainActivity&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Right-click your project and choose Properties. Click Android Manifest on the displayed page, and set a package name.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6bq8101b1wmgtcjm36p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6bq8101b1wmgtcjm36p.png" alt="Android Manifest settings screen, with package name option highlighted" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've completed all of these preparations, you'll be able to develop app functions.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup Mobile Number verification
&lt;/h2&gt;

&lt;p&gt;Create a VerifyCodeSettings object that contains the SMS messaging settings, including the action and language.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Call the &lt;strong&gt;RequestVerifyCodeAsync&lt;/strong&gt; method to send a request to the Auth Service server, and pass the country code and mobile number entered by a user, and the &lt;strong&gt;VerifyCodeSettings&lt;/strong&gt; object you just created, for Auth Service to send a verification code SMS message to the user.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Upon receiving the verification code, the user can start sign-up.&lt;br&gt;
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.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Call the &lt;strong&gt;CreateUserAsync&lt;/strong&gt; method to create a user.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;For an existing user, you need to implement the sign-in process, either via a verification code or a password.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

</description>
      <category>huawei</category>
      <category>android</category>
      <category>xamarin</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Integrating AppGallery Connect Crash Service in a Xamarin app for iOS</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Thu, 06 Jan 2022 10:27:06 +0000</pubDate>
      <link>https://dev.to/devwithzachary/integrating-appgallery-connect-crash-service-in-a-xamarin-app-for-ios-30dd</link>
      <guid>https://dev.to/devwithzachary/integrating-appgallery-connect-crash-service-in-a-xamarin-app-for-ios-30dd</guid>
      <description>&lt;p&gt;The Huawei AppGallery Connect Crash service is a free to use crash analytics service which is supported on a wide range of platforms and frameworks. &lt;/p&gt;

&lt;p&gt;Today lets take a look at how we can use in in a Xamarin, a hybrid framework and specifically set it up to work on iOS devices. This guide will start with a blank application but of course you can just as easily follow along and integrate into a pre-existing application!&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing the Xamarin Environment and Configuring Your Project
&lt;/h2&gt;

&lt;p&gt;You need to install Visual Studio for MAC first, and then select Mobile development with .NET in Visual Studio to &lt;a href="https://docs.microsoft.com/en-us/xamarin/cross-platform/get-started/requirements"&gt;install the Xamarin environment&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started-ios-0000001058442274"&gt;Create a project&lt;/a&gt; in AppGallery Connect and &lt;a href="https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-enabling-0000001050745155"&gt;enable HUAWEI Analytics&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Right-click your project and choose &lt;strong&gt;Manage NuGet Packages&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjjyowgxarsafaq6uf59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjjyowgxarsafaq6uf59.png" alt="Image description" width="491" height="491"&gt;&lt;/a&gt;&lt;br&gt;
Find the &lt;strong&gt;Huawei.Agconnect.iOS.Crash&lt;/strong&gt; package and install it.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiptjq7wtgoc5n4wv5yh4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiptjq7wtgoc5n4wv5yh4.png" alt="Image description" width="754" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find the &lt;strong&gt;Huawei.Agconnect.iOS.AgconnectCore&lt;/strong&gt; package, select the &lt;strong&gt;1.2.0.300&lt;/strong&gt; version, and install it. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbskejqzw26i3ilq84yhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbskejqzw26i3ilq84yhk.png" alt="Image description" width="756" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the plist file from your AppGallery Project to the project directory.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowfuw2mle9nnth2sx81n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowfuw2mle9nnth2sx81n.png" alt="Image description" width="472" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set &lt;strong&gt;Build Action&lt;/strong&gt; to &lt;strong&gt;BundleResource&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6pclrya0fxduipk6zwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6pclrya0fxduipk6zwg.png" alt="Image description" width="528" height="876"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Developing Your App
&lt;/h2&gt;

&lt;p&gt;Start by Configure the layout of your app for the testing of the crash service, in this example we will create three buttons to trigger different tests.&lt;br&gt;
Double-click main.storyboard to launch Xcode, and create the MakeCrash, CatchException, and CustomReport buttons&lt;/p&gt;

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

&lt;p&gt;In the &lt;strong&gt;MainActivity.cs&lt;/strong&gt; file, call &lt;strong&gt;AGConnectCrash.Instance.TestIt&lt;/strong&gt; to trigger a crash, call &lt;strong&gt;AGConnectCrash.Instance.SetUserId&lt;/strong&gt; to set a custom user ID, call &lt;strong&gt;AGConnectCrash.Instance.SetCustomKey&lt;/strong&gt; to set the key and value for a custom key-value pair, call &lt;strong&gt;AGConnectCrash.Instance.Log&lt;/strong&gt; to set the log level, and call &lt;strong&gt;AGConnectCrash.Instance.RecordException&lt;/strong&gt; to record a non-fatal exception.&lt;/p&gt;

&lt;p&gt;This could look something like:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  View Crash Report
&lt;/h2&gt;

&lt;p&gt;Tap MakeCrash, CatchException, and CustomReport in sequence, and check the report in AppGallery Connect.&lt;/p&gt;

&lt;p&gt;View the crash statistics. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa519zlmwwcgdsmrj1k9u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa519zlmwwcgdsmrj1k9u.png" alt="Image description" width="800" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the exceptions&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1zbj7x2p4fxwvgc9x7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1zbj7x2p4fxwvgc9x7y.png" alt="Image description" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Diagnose the causes of exceptions.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4944sg3n1msssneon3qe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4944sg3n1msssneon3qe.png" alt="Image description" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the custom key-value pairs.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqyjm15j0k78syg5au9j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqyjm15j0k78syg5au9j.png" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View the custom log levels&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fss3lir4axnjrbsmty9a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fss3lir4axnjrbsmty9a2.png" alt="Image description" width="800" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View custom user IDs. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtvarfml15a8zt7s4cte.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtvarfml15a8zt7s4cte.png" alt="Image description" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For details, please refer to:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-crash-introduction-0000001055732708"&gt;Crash for iOS&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.huawei.com/consumer/en/codelabsPortal/carddetails/CrashService-iOS"&gt;Codelab of Crash for iOS&lt;/a&gt;&lt;/p&gt;

</description>
      <category>huawei</category>
      <category>xamarin</category>
      <category>ios</category>
      <category>appgallery</category>
    </item>
    <item>
      <title>Using the Cloud DB JavaScript Server SDK in Cloud Functions</title>
      <dc:creator>Zachary Powell</dc:creator>
      <pubDate>Tue, 04 Jan 2022 10:00:36 +0000</pubDate>
      <link>https://dev.to/devwithzachary/using-the-cloud-db-javascript-server-sdk-in-cloud-functions-5b2i</link>
      <guid>https://dev.to/devwithzachary/using-the-cloud-db-javascript-server-sdk-in-cloud-functions-5b2i</guid>
      <description>&lt;p&gt;With &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-introduction-0000001059279544"&gt;Cloud Functions&lt;/a&gt;, you can configure a CLOUDDB trigger to call a function when data is entered, deleted, or modified in Cloud DB.&lt;br&gt;
The &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-get-started-serverjs-0000001127676879"&gt;Cloud DB&lt;/a&gt; service has been released with a JavaScript Server SDK, which can be used in the Node.js environment that the Cloud Functions service supports. In this article, I will elaborate on how to enter and query data with the Cloud DB JavaScript Server SDK in Cloud Functions.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0ngd3j3w1nfd9uemev5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0ngd3j3w1nfd9uemev5.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Enabling Required Services
&lt;/h2&gt;

&lt;p&gt;You need to enable two services.&lt;br&gt;
First of all, sign in to &lt;a href="https://developer.huawei.com/consumer/en/service/josp/agc/index.html#/"&gt;AppGallery Connect&lt;/a&gt; and perform the following operations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable Cloud Functions.
Click &lt;strong&gt;My projects&lt;/strong&gt;, click your project card, and go to &lt;strong&gt;Build&lt;/strong&gt; &amp;gt; &lt;strong&gt;Cloud Functions&lt;/strong&gt;. On the &lt;strong&gt;Cloud Functions&lt;/strong&gt; page, click &lt;strong&gt;Enable now&lt;/strong&gt;. Click + &lt;strong&gt;New Function&lt;/strong&gt; to create a function.&lt;/li&gt;
&lt;li&gt;Enable Cloud DB.
Click &lt;strong&gt;My projects&lt;/strong&gt;, click your project card, and go to &lt;strong&gt;Build&lt;/strong&gt; &amp;gt; &lt;strong&gt;Cloud DB&lt;/strong&gt;. On the Cloud DB page, click &lt;strong&gt;Enable now&lt;/strong&gt; and then create &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-get-started-0000001127676473#section138971210193319"&gt;an object type&lt;/a&gt; and &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-get-started-0000001127676473#section138971210193319"&gt;a Cloud DB zone&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnwplf1wyebh0y1ar4ag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnwplf1wyebh0y1ar4ag.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Configuring the JavaScript Server SDK of Cloud DB
&lt;/h2&gt;

&lt;p&gt;Here, I will use the &lt;strong&gt;src&lt;/strong&gt; file in the Huawei service &lt;a href="https://github.com/AppGalleryConnect/agc-demos/tree/main/Server/agc-clouddb-demo-javascript"&gt;demo&lt;/a&gt; to demonstrate how the JavaScript Server SDK is configured. You can also download the file and use it for your own file from GitHub.&lt;/p&gt;

&lt;p&gt;Then you need to do the following in AppGallery Connect:&lt;/p&gt;
&lt;h3&gt;
  
  
  Export an object type.
&lt;/h3&gt;

&lt;p&gt;On the &lt;strong&gt;Cloud DB&lt;/strong&gt; page, export the &lt;strong&gt;BookInfo&lt;/strong&gt; object type to a JS file, and then add it to the model directory of your project.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxivr7t8rux5tgn4d8cr9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxivr7t8rux5tgn4d8cr9.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Download the authentication credential.
&lt;/h3&gt;

&lt;p&gt;Go to Project settings &amp;gt; Server SDK. On the Server SDK tab page, click Create for API client first, and then click Download credential to download the authentication credential. Finally, add it to the model directory of your project&lt;/p&gt;
&lt;h3&gt;
  
  
  Modify the path to the credential.
&lt;/h3&gt;

&lt;p&gt;You need to modify the path to the credential as it was saved to the model directory. In the CloudDBZoneWrapper.js file (use the _dirname method to obtain the file), modify the initialization code as follows:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Configure a handler.
&lt;/h3&gt;

&lt;p&gt;You can either use the Start.js file as the handler by default or create a new one. For example, the inde.js file is created as a handler. The sample code is as follows:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Packaging Your Project and Configuring a Trigger
&lt;/h2&gt;

&lt;p&gt;You need to package your project, upload it to Cloud Functions, and test it with events. The handler file should be saved in the root directory.&lt;/p&gt;

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

&lt;p&gt;Sign in to AppGallery Connect and go to the Cloud Functions page. Upload your package and set the name of the handler to index.myHandler &lt;/p&gt;

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

&lt;p&gt;Configure a CLOUDDB trigger. Click + Add Trigger and configure the type, Cloud DB zone, and object type for the trigger.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Testing the Function
&lt;/h2&gt;

&lt;p&gt;In AppGallery Connect, go to &lt;strong&gt;Cloud Functions&lt;/strong&gt; &amp;gt; &lt;strong&gt;Test&lt;/strong&gt;.&lt;br&gt;
Configure a trigger event according to the &lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-programmode-0000001058311525#section207831182811"&gt;documentation&lt;/a&gt;&lt;br&gt;
If you need to configure a data insertion event, add the following sample code.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Check the test result.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-introduction-0000001059279544"&gt;Cloud Functions&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudfunction-programmode-0000001058311525"&gt;Defining a programming model&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-get-started-serverjs-0000001127676879"&gt;Cloud DB JavaScript Server SDK&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>huawei</category>
      <category>database</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
