Expert: Xamarin Android College Campus Placement App Using In-App Purchase and Login with Huawei ID


In this article, I will create a College Campus Placement Centre Demo App which highlights ongoing college placement with all listed companies and their details. Student can easily apply and redeem points through IAP. I have integrated HMS Account and IAP Kit which is based on Cross-platform Technology Xamarin.

HMS IAP Service Introduction

HMS In-App Purchase Kit allows purchasing any product from the application with highly secure payment. Users can purchase a variety of products or services, including common virtual products and subscriptions, directly within your app. It also provides a product management system (PMS) for managing the prices and languages of in-app products (including games) in multiple locations.

These are the following 3 types of in-app products supported by the IAP:

1. Consumable: Consumables are used once, are depleted, and can be purchased again.

2. Non-consumable: Non-consumables are purchased once and do not expire.

3. Auto-renewable subscriptions: Users can purchase access to value-added functions or content in a specified period of time. The subscriptions are automatically renewed on a recurring basis until users decide to cancel.

Account Kit Service Introduction

HMS Account Kit allows you to connect to the Huawei ecosystem using your HUAWEI ID from a range of devices, such as mobile phones, tablets, and smart screens.

It’s a simple, secure, and quick sign-in and authorization functions. Instead of entering accounts and passwords and waiting for authentication.

Complies with international standards and protocols such as OAuth2.0 and OpenID Connect, and supports two-factor authentication (password authentication and mobile number authentication) to ensure high security.


1. Xamarin Framework

2. Huawei phone

3. Visual Studio 2019

App Gallery Integration process

1. Sign In and Create or Choose a project on AppGallery Connect portal.

2. Navigate to Project settings > download the configuration file.

3. Navigate to General Information > Data Storage location.

4. Navigate to Manage APIs > enable APIs to require by an application.

5. Navigate to My apps > Operate, and then enter details in Add Product.

6. Click View and Edit in the above screenshot, enter Product price details, and then click Save.

7. Click Activate for product activation.

Xamarin Account Kit Setup Process

1. Download Xamarin Plugin all the aar and zip files from below URL:

2. Open the XHwid-5.03.302.sln solution in Visual Studio.

Xamarin IAP Kit Setup Process

1. Download Xamarin Plugin all the aar and zip files from below URL:

2. Open the XIAP- solution in Visual Studio.

3. Navigate to Solution Explorer and Right-click on jar Add > Existing Item and choose aar file which downloads in Step 1.

4. Right-click on added aar file then choose Properties > Build Action > LibraryProjectZip.

Note: Repeat Step 3 & 4 for all aar file.

5. Build the Library and make dll files.

Xamarin App Development

1. Open Visual Studio 2019 and Create a new project.

2. Navigate to Solution Explore > Project > Assets > Add JSON file.

3. Navigate to Solution Explore > Project > Add > Add New Folder.

4. Navigate to Folder(created) > Add > Add Existing and add all DLL files.

5. Right click > Properties > Build Action > None.

6. Navigate to Solution Explore > Project > Reference > Right Click > Add References then Navigate to Browse and add all DLL files from the recently added Folder.

7. Added reference then click Ok.


This activity performs all the operation regarding login with Huawei Id.


This activity performs all the operation In-App purchasing and display list of company with package details.

Xamarin App Build Result

1. Navigate to Solution Explore > Project > Right Click > Archive/View Archive to generate SHA-256 for build release and Click on Distribute.

2. Choose Distribution Channel > Ad Hoc to sign apk.

3. Choose Demo Keystore to release apk.

4. Build succeed and Save apk file.

5. Finally here is the result.

Tips and Tricks

1. It is recommended that the app obtains the public payment key from your server in real-time. Do not store it on the app to prevent app version incompatibility caused by the subsequent key upgrade.

2. The sandbox testing function can be used only when the following conditions are met: A sandbox testing account is successfully added, and the value of versionCode of the test package is greater than that of the released package. In the HMS Core IAP SDK 4.0.2, the isSandboxActivated API is added to check whether the current sandbox testing environment is available. If not, the API returns the reason why the environment is unavailable.


In this article, we have learned how to integrate HMS In-App Purchase and Account Kit in Xamarin based Android application. Student can easily apply in a listed company which offers campus placement.

Be sure to like and comments on this article, if you found it helpful. It means a lot to me.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store