Coding-Free Integration of Appgallery Connect Cloud Hosting Into an Android App
This article shows you how to use AppGallery Connect Cloud Hosting with an example of domain name hosting to help get you started.
Join the DZone community and get the full member experience.Join For Free
When it comes to building a website, it’s always a hassle having to apply for a domain name, set up a website server, manage certificates, and perform other O&M operations. HUAWEI AppGallery Connect provides easy-to-use app deployment capabilities so that tedious tasks such as domain name application and page distribution are automatically performed for you, allowing you to focus on more important things, such as designing your app’s UI, UX, and service logic.
This post will show you how to use AppGallery Connect Cloud Hosting with an example of domain name hosting.
1. Enabling Cloud Hosting
Cloud Hosting is currently still in beta testing. To use the service, you’ll first need to send an application by email.
Once you’ve obtained permission to use the service, sign in to AppGallery Connect, go to My projects, click your project, and go to Build > Cloud Hosting on the left.
On the Cloud Hosting page, click Enable now.
2. Creating a Site
A site is similar to a domain name. When you create a site, you’re also creating a domain name. According to government regulations, each site in the Chinese mainland must have its own domain name. But sites outside the Chinese mainland can share the same domain name, as long as the name is unique.
2.1 Creating a Site in the Chinese Mainland
If the data storage location of your app is the China site, Cloud Hosting can only be used to host your custom domain names. The documentation illustrates the detailed requirements.
On the Site Management tab page, click New site, enter a domain name, and click Next.
A dialog box is displayed to verify the ownership of your domain name.
1. In the dialog box, copy the value on the right.
2. Go back to the DNS console of the domain name provider. I’ll use HUAWEI CLOUD as an example. Go to Domain and Website > Domain Name Service > DNS Resolution > Private Zones, click your domain name, and click Add Record Set in the upper right corner.
3. Complete the domain name, set Type to TXT, and paste the copied value in the Value text box.
4. Click OK, go back to AppGallery Connect, and click Next.
3. If the verification is successful, the system will configure the CDN acceleration and SSL certificate for the domain name. This may take a while.
4. Configure the CNAME value in the same way. On your DNS console, set Type to CNAME — Map one domain to another.
2.2 Creating a Site Outside the Chinese Mainland
It is much easier to create a site outside the China site. For example, to create a site in Singapore, just click New site and enter a unique domain name, as shown in the following figure.
3. Managing Versions
1. On the Site management page, click Manage version in the Operation column of the site you just created.
2. Click New version. On the page that is displayed, click Browse and upload a compressed web page package you have developed.
3. Please remember that the HTML file must be in the root directory of the compressed package you upload. Also, as shown in the following example, the access entry or the default home page of your website must be named index.html.
4. If this message is displayed, the upload is successful. Now, click OK.
4. Releasing a Version
After you successfully upload a version, wait for 1 to 2 minutes and click Refresh. If the version status changes to Released, the version is successfully released.
5. Summary and References
With Cloud Hosting, you can host a static page by just performing a few simple configurations on the console.
Here’s the website file I used in this example: HUAWEI AppGallery Connect Cloud Hosting documentation.
Opinions expressed by DZone contributors are their own.