Integration Of Huawei Account Kit, Ads Kit and Scan Kit in Student Attendance Application in Android.

Overview

Student Attendance application is an application that allows students to scan the QR code to take their attendance. This application is developed for the purpose of making recording attendance easier for both lecturers and students. In this article, we will show you the integration of Huawei Kits in the Student Attendance application that we had developed. In this application, we had integrated account kit, ads kit and scan kit.

Preparation

1) Register as a Huawei Developer and ensure your account is verified in order to use the HMS core kits.

2) Create an app in the AppGallery Connect.

3) Generate an SHA-256 certificate fingerprint for the application you are developing.

4) In the Manage APIs section, enable the required kits. (Account kit, Ads kit and Scan kit)

5) Download the agconnect-services.json file from App Information, copy and paste in your android project under application directory.

Integration:

1)In android studio, under build.gradle file, copy and paste the following code.

2) In the settings.gradle file for the project, add the following code.

3) Next, under application directory, in the build.gradle file, add the plugins and dependencies below. The versions may vary for each dependencies, therefore, you may refer to the https://developer.huawei.com/consumer/en/hms to get the latest versions of account kit, ads kit and scan kit provided.

4) Sync the gradle file.

5) Next, in the AndroidManifest.xml, copy and paste the following code.

Implementation of Huawei Kits :

1) Integration of Huawei Account Kit and Ads Kit.

In this application, the user should be able to sign in using their Huawei Id and sign out by clicking the “Sign Out” button on the bottom of the screen. The type of ads format used in this application is a banner ads. The banner ads should appear on top of the screen. Below is the code for this function.

2) Integration of Huawei Scan Kit.

To implement the scan kit, we can build a button so that user can interact with the button to use the scan kit. Below is the code for the button.

In the OnActivityResult, on the MainActivity.java file, copy and paste the following code.

Below is the code in order for the button to work and use the scan kit.

Output

User Interface for Student Attendance Application in Android
User Interface shown when the user successfully signed in the application
Camera scanner without the light
Camera scanner with light
User Interface shown when the user has log out the application

Conclusion

In this article, we have learned how to integrate Huawei Account kit, Ads kit and Scan kit in a simple student attendance application. The idea behind the development of this application is, student’s attendance should be able to be recorded easily via scanning the qr code using scan kit in this application. During the development of this application, Mekhi has taken the role of integrating the 3 kits, Syafiqah has taken the role of making the application prettier and Thyfanney is in charge of the article. Finally, there are definitely plenty of improvements can be done on this application and one of them is by developing a more user-friendly UI design to ease user’s navigation through the application as well as implementing more functions. Last but not least, we would also like to thank Mr. Nithin for all the lessons and guidance given throughout this HMS course.