HCMC NATIONAL UNIVERSITY UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE & ENGINEERING
THESIS
A MOBILE APPLICATION FOR SHOPPING AUTOMATION
MAJOR: COMPUTER SCIENCE
INSTRUCTOR: ASSOC PROF TRAN MINH QUANG REVIEWER : DR PHAN TRONG NHAN
-o0o -
STUDENT: VO DONG HO 1752219
HO CHI MINH CITY, 26TH July, 2021
Trang 2ĐẠI HỌC QUỐC GIA TP.HCM CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM - Độc lập - Tự do - Hạnh phúc
TRƯỜNG ĐẠI HỌC BÁCH KHOA
KHOA:KH & KT Máy tính NHIỆM VỤ LUẬN ÁN TỐT NGHIỆP
BỘ MÔN:KH Hệ thống thông tin Chú ý: Sinh viên phải dán tờ này vào trang nhất của bản thuyết trình
1 Đầu đề luận án:
A mobile application for shopping automation
2 Nhiệm vụ (yêu cầu về nội dung và số liệu ban đầu):
- Investigate and identify the stages that can be automated in a retail system - Determination of suitable technology and applicability
- Determine the factors that affect the success of the model
- Conducting technology research and building a complete model - Implement and evaluate the results achieved
3 Ngày giao nhiệm vụ luận án: 01/03/2021 4 Ngày hoàn thành nhiệm vụ: 01/08/2021
Associate Professor Tran Minh Quang, the whole thesis Nội dung và yêu cầu LVTN đã được thông qua Bộ môn
Ngày 01 tháng 03 năm 2021
(Ký và ghi rõ họ tên) (Ký và ghi rõ họ tên)
PGS TS Trần Minh Quang PGS TS Trần Minh Quang
PHẦN DÀNH CHO KHOA, BỘ MÔN:
Người duyệt (chấm sơ bộ):
Ngày bảo vệ: Điểm tổng kết:
Nơi lưu trữ luận án:
Trang 3Acknowledgement
I would like to thank my instructor, Mr Tran Minh Quang, for guiding me in this thesis Thanks to Mr Quang 's suggestions and commenting for my team, I am able to eliminate all unnecessary tasks and unusable ideas that slowing our progress down Your replies and comments each time I commit my work really help us to improve gradually and have a more overall view about the thesis Without your assistance and dedicated involvement, this thesis would have not be accomplished completely
Also, I would like to express my gratefulness to my parents, my friends that support during this difficult time I can move on and reach the this stage because of your supports and encouragements
Trang 5Abstract
The speed of urbanization is clearly increasing, leading to the widespread urban lifestyle everywhere The fast pace of life (large workloads, life's worries, ) leads to more and more people living “hurriedly” and needing services that can not only respond well but also quickly our basics
Industries such as fast food, fast fashion, convenience retail are facing ever greater opportunities to reach out, expand and become an indispensable part of urban life On the other hand, traditional retailers face the challenge of great competition, requiring improved procurement process to stand firm in the market
Automating the shopping process is no longer an option, but a necessity, to address growing demand from customers With the remarkable achievements of the automation industry in general and the field of artificial intelligence and computer vision in particular, a revolution in the form of shopping is sure to happen in the near future But at present, technologies like RFID - Radio Frequency Identification, thanks to efficiency, ease of operation, high accuracy and low cost, still gain absolute trust and are widely used, from warehouses, factories from production to retail stores
Grasping the current trend and competition of the retail industry, our team has done research with the central goal of successfully building an automated shopping model, HoApp, a convenience store model that applies technologies such as QR to automate customer shopping process
By sequencing the steps in the research process from understanding technology (concept, operating principles, structure, cost), referring to and inheriting successful automated shopping models, market exploration, conceptualization, design sketch, continuous building and editing, finally testing and evaluating results, HoApp is expected to not only speed up the shopping process, provide a convenient shopping experience for users, but also bring benefits to the sellers from reducing labor cost
Trang 62.2.2 A brief about Kotlin 23
2.2.3 About Google Firebase 24
2.2.4 Implement MoMo E-Wallet for payment 26
2.2.5 Android Studio Profiler 28
3 System Analysis and Design 29
3.1 Use case Diagram 29
3.2 Use case Descriptions 30
3.3 Flow Chart Diagrams 33
3.4 Entity Relationship Diagram 39
4.5 User main screen 50
4.6 Add Product to Cart 51
Trang 8Figures and Tables
Figure 2.1 Amazon Go application interfaces 15
Figure 2.2 A BingoBox store 18
Figure 2.3 Types of QR 22
Figure 2.4 MoMo Processing Diagram 28
Figure 2.5 Profiler window in Android Studio 29
Figure 3.1 Use case Diagram for HoApp 30
Figure 3.2 Flowchart for Register 34
Figure 3.3 Flowchart for Login 34
Figure 3.4 Flowchart for Change password 35
Figure 3.5 Flowchart for Search Products 35
Figure 3.6 Flowchart for View Product Information 35
Figure 3.7 Flowchart for Add Product to Cart 35
Figure 3.8 Flowchart for View Receipts 36
Figure 3.9 Flowchart for Edit Profile 36
Figure 3.10 Flowchart for View User Ranking 36
Figure 3.11 Flowchart for Modify Products in Cart 37
Figure 3.12 Flowchart for Check Out 37
Figure 3.13 Flowchart for Get Request from Customer 37
Figure 3.14 Flowchart for Accept Payment from Customer 38
Figure 3.15 Flowchart for Admin Search Products 38
Figure 3.16 Flowchart for Admin Add a product 38
Figure 3.17 Flowchart for Admin View Product’s Information 39
Figure 3.18 Flowchart for Admin Edit Product Information 39
Figure 3.19 Flowchart for Admin View Products Sales 39
Figure 3.20 Entity Relationship Diagram for HoApp System 40
Figure 3.21 Class Diagram for HoApp System 44
Trang 9Figure 3.22 Login Screen 47
Figure 3.23 Register Screen 48
Figure 3.24 Register Successfully 48
Figure 3.25 Forgot Password screen 49
Figure 3.26 Reset Password Email 50
Figure 3.27 Reset Password screen 50
Figure 3.28 Reset Password successfully 50
Figure 3.29 User’s profile information if they login for the first time 51
Figure 3.30 User’s Product screen 52
Figure 3.31 User’s barcode scanning screen 53
Figure 3.32 User’s cart 54
Figure 3.33 User’s receipts 55
Figure 3.34 Admin screen 56
Figure 3.35 Add a Product screen 57
Figure 3.36 List products screen 58
Figure 3.37 Modify product screen 59
Figure 3.38 Search product screen 60
Figure 3.39 Search product successfully 60
Figure 3.40 Scan QR code screen 61
Figure 3.41 Get user’s receipt successfully 61
Figure 3.42 Refund Receipt screen 62
Figure 3.43 Get user’s Cart screen 63
Figure 3.44 Dashboard for each category of products 64
Figure 3.45 Dashboard for sales in a year 65
Figure 3.46 User’s online order 66
Figure 3.47 User’s Order information 66
Figure A.1 MoMo icon 74
Figure A.2 MoMo linking sequence diagram 74
Table 2.1 BingoBox RFID vs Computer Vision check-out stand 20
Table 3.1 Use case descriptions for Customer 31
Table 3.2 Use case descriptions for Staff 32
Table 3.3 Use case descriptions for Admin 33
Table 3.4 Entity Relationship Diagram Description 41
Table 5.1 Loading time between pages in Admin application 67
Table 5.2 Loading time between pages in User application 67
Table 5.3 Time for actions in Admin application 68
Table 5.4 Time for actions in User application 69
Trang 101 Research overview1.1 Research reason
In the context of an increasingly competitive market, businesses and retailers are investing heavily to improve their business processes in order to offer a business model that outperforms their competitors in terms of performance or in terms of sales In addition to market analysis, changing marketing tactics, optimizing the supply chain, managing costs and staff well, improving consumer’s shopping processes have always been the top priorites of business
User’s shopping experience is what every shopping process wants to be improved It is obvious that successful retailing today comes down to obsessing about customer experience And shopping automation, with the ability to address core issues that negatively impact the shopping experience like Endless queues, overcrowded stores, waiting for hours, stressed out sale assistants, will be the defining element of retail business processes Arcording to Global Retail Automation Market 2020-2025 – a report providing a detailed overview of the major driver, opportunities, challenges, current market trends and strategy affecting the Global Retail Automation market, the retail automation market was valued at USD 12.45 billion in 2019 and is expected to reach USD 24.6 billion by 2025 at a CAGR of 11.2% over the forecast period from 2020 to 2025
Automation has made some progress, but many still remain How to simultaneously improve customer satisfaction when shopping while still ensuring economic efficiency and scalability (so that automatic shopping models can replace the traditional model) are the problems that businesses as well as technology companies are trying to find better and better solutions And which automated model will bring economic efficiency? Which technologies should be applied and how to provide a good user experience? How can I ensure in terms of security, feasibility, response from consumers, competitiveness with other models? For the above reasons, the topic "A mobile application for automation shopping" is implemented with the aim of building a shopping automation model that can enhance the user's shopping experience but still ensure economic efficiency for retailer
Trang 111.2 Aims of the study
Overall objectives
Successfully design a convenience store shopping automation model, apply suitable technologies to replace people in several operations, solving the problem of customer experience and economy problems for businesses
Detail objectives
- Identify the stages that can be automated
- Determination of suitable technology and applicability - Determine the factors that affect the success of the model
- Conducting technology research and building a complete model - Implement and evaluate the results achieved
Trang 121.3 Methods of study
A shopping model is called automatic when applying technology or machines to do one or more of the following: replacing staff in several stages, changing traditional payment methods by electronic payment methods, eliminating long waiting lines and other on-site customer care services In order to be put into operation, the automatic model still has to meet the inevitable basics:
- Buyers get exactly what they want, avoiding the situation of machinery and technology errors that prevent customers from purchasing valid products
- Buyers pay exactly what they chose, neither underpaid nor overpaid - Seller receives the exact money buyers paid
- Security and economic efficiency criteria
To meet the first three basic things, online payment has been considered and chosen to conduct research and development, with the main task of identifying the products customers choose to buy and confirming customer’s bought products before they leave the store, with absolute precision
E-wallet payment is a payment method used so that buyer's money can reach the seller because of the popularity and reliability of e-wallet in the market QR code technology is applied to control customer’s access to the store and for customer to make payment To ensure the security aspect of business owners, the model requires users to register and declare their identity on the HoApp self-developed application
Trang 131.4 Outline
In the first part of the thesis report, some successful automation shopping models will be introduced about the process and technology, along with the reasons for the choice implementation, the advantages, the intentions for the research as well The second part is the Design part, I will explain more clearly how our HoApp model works and provides a thorough look about the entire system The next part is Evaluation, and in this part, I evaluate how the app performs in testing Finally, last part is the conclusion and development direction for the thesis
Trang 142 Related works
What is Shopping Automation?
Shopping automation, or retail automation, is a term that refers to the application of technologies and machines in retail businesses to improve traditional shopping processes and solve the problem of queues at peak hours but still ensure a good experience for consumers
The term A-RETAIL, indicates Automated Retail or Retail Automation and describes the process of using technology to automate or semi-automate the retail experience It means this: self-check kiosks, mobile app to pay in-store or getting rid of checkout altogether
Retail automation can include inventory management, accounting and bookkeeping, analytics reporting, purchasing and other similar tasks Some common automations are point-of-sale (POS), inventory and ordering software, which automatically tracks sales and stock levels
Without automation, retailers are limited to how far they can expand their inventory, sales channels, and customer reach, as manual systems are laborious and time-consuming Automation can also increase businesses' agility and functionality so they can respond to requests accurately and efficiently
Trang 152.1 Some successful automation shopping model 2.1.1 Amazon Go
The most ideal automatic shopping model, promising to become a trend in the future that I want to mention is Amazon Go, the model of the world's leading retail and technology corporation, Amazon
Amazon Go is a chain of convenience stores in the United States, operated by the online retailer Amazon The stores are partially automated, with customers able to purchase products without being checked out by a cashier or using a self-checkout station.[1]Amazon uses several technologies to automate Go stores, including computer vision, deep learning algorithm, and sensor fusion for the purchase, checkout, and payment steps associated with a retail transaction.[2]
Figure 2.1 Amazon Go application interfaces [3]
The shed-water event of 2018 has been the opening of the first Amazon Go store in Seattle, at the beginning of year After more than 2 years of tests the e-commerce giant opened its first store almost completely automated, where the customer can just walk out with whatever items they choose and have them charged to their Amazon Prime account [4]
Trang 16No cash, no product’s code scanning, no waiting lines, all are achieved since Amazon has applied effectively computer vision, deep learning algorithms, and sensor fusion for the purchase, checkout, and payment steps associated with a retail transaction Dreams come true with Amazon Go when the shopping experience has never been so easy and convenient
A more specific description of the shopping process at Amazon Go:
- To shop at Amazon Go, you will need to first download the Amazon Go app and connect your Amazon account
- When you're ready to shop at Amazon Go, you must scan your barcode in the app as you walk into the store Then, you can take whichever items you want and simply walk out of the store
- The Amazon Go store has sensors that track what you take off or put back on the shelves When you leave the store, your Amazon account will be charged for the items you left the store with, and you can check your receipt in the app to make sure it is correct
In addition, Amazon Go also equipped with a series of smart carts with build-in cameras integrating computer vision, a display screen and a QR code reader for customers to purchase and pay right on this shopping cart, bringing familiar but still convenient and efficient shopping experience
Although successfully and efficiently completed and put into operation, the cost of the technology is still the biggest barrier for the Amazon Go model to be replicated and replace the traditional method Building and putting into operation a convenience store using the Amazon Go model costs $ 1 million [5] and it would take about two years for Amazon to break even This makes the Amazon Go model not viable for small and medium businesses
The failure to achieve absolute accuracy and the cost of the technology is too high makes computer vision models in general and Amazon Go in particular difficult to compete with RFID technology, which has been used for a long time and gained giant trust from businesses In addition, the workforce reduction issue that is not supported by people in some Western countries, especially the US, also contributes to the Amazon Go model that has not yet replicated and reached markets
Trang 17BingoBox is China’s first scalable 24-hour cashier-free convenience store and a GGV portfolio company BingoBox features a smart counter for a staff-less check-out experience, and uses RFID and computer vision to keep track of items Users scan a QR code to enter the store, and pay via Alipay or WeChat Pay
A more specific description of the shopping process at BingoBox: To enter a BingoBox, you must scan a QR code to register on its website Then to check out, you place the items on a counter, scan the QR code and then pay with WeChat Pay or AliPay which is a mobile payment As you head out, a sensor at the door can automatically detect any unpaid items The door will only unlock once all the items have been paid.[6]
With a friendly, compact store design (only 800 SKUs in a store), competitive price, near crowded areas along with the thorough application of RFID technology in item identification, tracking of goods and security, BingoBox has achieved great success thanks to the reduction of rental and labor costs (only one-fifteenth of the traditional operating cost than the outside stores) as well as the response of the Chinese people BingoBox also recently started bringing computer vision, called FAN-AI, into their stores, not only to recognize products when checking out but also to communicate with customers when they need assistance
BingoBox is a good model and suitable for small and medium businesses The market in the world is still abundant and the coverage of BingoBox is not high, which is an opportunity for businesses to learn and enter the market with a similar model
Trang 18
Figure 2.2 A BingoBox store [7]
BingoBox model is considered to be very potential and highly feasible when applied in the Vietnamese market for the following reasons:
- The Vietnamese market is large and potential and has not really had a shopping automation model like BingoBox applied
- The compactness, labor and rental cost saving make it competitive with traditional convenient store
- The popularity of MoMo e-wallet and young people's willingness to experience the new will be advantageous when the model is deployed
Trang 192.1.3 Advantages and Disadvantages of Amazon Go and BingoBox
About the advantages: Amazon Go:
- Is it the ideal automation shopping system because of its computer vision techniques applying to all of the shopping processes
- Easy to understand, convenient, highly efficient and accuracy when applying
- Have a group of technicians and staffs to help with the technology and shopping progress
- Receipt is handled quickly and after shopping successfully, an email is sent to user’s app (in 24 hours)
- Have staffs to receive feedback and criticism
- There are smart carts to assist the shopping experience BingoBox:
- Is the unmanned model (model that doesn’t need human to operate) - High economic efficiency
- Quick payback time (about 10 months per store)
- Low building price for one store, affordable with small and medium enterprises - Save on space rental cost because of small design and have no staffs
- Can move goods in store easily, even all goods to another store
- Easy to understand, can register an account in place About the disadvantages: Amazon Go:
- Technique is complicated and high cost
- Not feasible for small and medium companies and stores when their economical efficiency is not as expected
- Need a long time to have user’s recognition and trust
- High efficiency but not 100%, relying on camera’s check and security staffs - Human rights issues in U.S when applying technology to replace human’s work BingoBox:
- RFID stickers have a quite high price, not efficient when buying in small amount - Need staffs to stamp the stickers for every products
- Can’t detect if someone remove the sticker
- If a problem happening in store, there is no one in place to solve the situation To have a more specific view between the two models, I have implemented the following table:
Trang 20Table 2.1 BingoBox RFID vs Computer Vision check-out stand
Subjects of application
Convenient store and grocery store Convenient store
Purpose
- Using high tech to enhance the efficiency of old shopping environment
- Solving waiting lines during peak hours, which may lead to the customer going to another store - Reduce labor costs since cashier in US is very highly paid
- Creating new shop and a new environment for consumers, a new way to buy products
- Creating a new channel, a high efficiency channel, an option other than the traditional model
- Aiming towards a small cost model by reducing labor and rental cost
- Cashier-free store (still have product consultants, on-site customer support staff, security)
- Unmanned store
Applied technology
- Computer vision, deep learning algorithms, and sensor fusion for the purchase, checkout, and payment steps associated with a retail
- transaction
- RFID and computer vision to keep track of items, QR code to enter the store
Size of the store
1,800 square feet (~160m2) with 1000 items (Go convenient) - 10,400 square feet (~1000m2) with 5000 items (Go Groceries)
- Medium and large size, with areas of 12.48m2and 15.6m2
respectively with 500-800 items respectively
Use of technology in
- Access and make online payment via
- Amazon Go app with Amazon account
- QR code scanning at check-in and when making payment
- RFID tags on each product, RFID reader to recognize product - Small machine called BingoBox applying computer vision to
recognize product (recently)
- Online payment via Wechat or Alipay
Trang 21Number of stores
Future potential With 1b$ investment each year, - Amazon expect to reach 3000 Go stores in 2021
Taken over and supported from Alibaba,
- BingoBox aims to expand and reach 5000 stores worldwide
Through investigation and consideration, I think that the BingoBox model is feasible and can inherit good things from this model The advantages of BingoBox appear to be much more dominant and suitable than the Amazon Go model when applied in Vietnam But then, the question is, can all of BingoBox’s superiorities be applied to my shopping application?
The answer is: it’s possible, but it also takes immense skills and efforts to work and it is definitely time-consuming So in order to finish the application in time, minimizing the criteria is necessary, but the basic elements of a shopping app must be maintained After determining the minimum criterias, I have come to a conslusion: My application will optimize the QR code so that it can be used for many purposes With a correct direction for implementation, the QR code can make the shopping faster and easier since only one QR code is needed to perform many shopping actions
Trang 222.2 Background 2.2.1 QR code
The first technology that I apply to the HoApp model is the QR code A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or two- dimensional barcode) first designed in 1994 for the automotive industry in Japan A barcode is a machine-readable optical label that contains information about the item to which it is attached In practice, QR codes often contain data for a locator, identifier, or tracker that points to a website or application QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently; extensions may also be used
The Quick Response system became popular outside the automotive industry due to its fast readability and greater storage capacity compared to standard UPC barcodes Applications include product tracking, item identification, time tracking, document management, and general marketing
A QR code consists of black squares arranged in a square grid on a white background, which can be read by an imaging device such as a camera, and processed using Reed– Solomon error correction until the image can be appropriately interpreted The required data is then extracted from patterns that are present in both horizontal and vertical components of the image
There are different types of QR code:
Figure 2.3 Types of QR [8]
Trang 23QR Code Model 1 and Model 2:
Model 1 is the original QR code The largest version of this code is 14 (73 x 73 modules), which is capable of storing up to 1,167 numerals
Model 2 is QR Code created by improving Model 1 so that this code can be read smoothly even if it is distorted in some way QR Codes that are printed on a curved surface or whose reading images are distorted due to the reading angle can be read efficiently by referring to an alignment pattern embedded in them This code can encode up to 7,089 numerals with its maximum version being 40 (177 x 177 modules)
Micro QR Code:
A major feature of Micro QR Code is it has only one position detection pattern, compared with regular QR Code that require a certain amount of area because position detection patterns are located at the three corners of a symbol The largest version of this code is M4 (17 x 17 modules), which can store up to 35 numerals
iQR Code Model:
iQR allows a wide size range of codes from ones smaller than the traditional QR Code and Micro QR Code to large ones that can store more data than these This code can be printed as a rectangular code, turned-over code, black-and-white inversion code or dot pattern code (direct part marking) as well, allowing a wide range of applications in various areas The maximum version can theoretically be 61 (422 x 422 modules), which can store about 40,000 numerals
SQRC QR Code Model:
A QR Code that has a reading restriction, can carry two types of data: public and private The private data can be read only with a dedicated reader having the cryptographic key, which provides data protection Since SQRC looks exactly the same as the regular QR Code, it can prevent forgery and tampering
Frame QR Code Model:
This code has an area, or a frame, holding an image Since the shape and color of the frame can be changed flexibly, the code has a variety of applications Since letters and images can be inserted inside the area, FrameQR can be used for promotion, authenticity judgment and other various uses
In our model, QR code Model 2 is chosen for our project as it is popular and massively used in nowadays apps This code also has a decent size, not too small for customer to scan when checking in like iQR And because I only need tracker that points to an application like bank account, I don't need to use FrameQR which can contain images.
Trang 242.2.2 A brief about Kotlin What is Kotlin?
Kotlin is a general purpose, free, open source, statically typed “pragmatic” programming language initially designed for the JVM (Java Virtual Machine) and Android that combines object-oriented and functional programming features It is focused on interoperability, safety, clarity, and tooling support Versions of Kotlin targeting JavaScript ES5.1 and native code (using LLVM) for a number of processors are in production as well [9]
Kotlin originated at JetBrains, the company behind IntelliJ IDEA, in 2010, and has been open source since 2012
Kotlin for Android
Up until May 2017, the only officially supported programming languages for Android were Java and C++ Google announced official support for Kotlin on Android at Google I/O 2017, and starting with Android Studio 3.0 Kotlin is built into the Android development toolset Kotlin can be added to earlier versions of Android Studio with a plug-in
Kotlin compiles to the same byte code as Java, interoperates with Java classes in natural ways, and shares its tooling with Java Because there is no overhead for calling back and forth between Kotlin and Java, adding Kotlin incrementally to an Android app currently in Java makes perfect sense
Why I choose Kotlin over Java and other programming languages
The question of whether to choose Kotlin or Java for new development has been coming up a lot in the Android community since the Google I/O announcement The short answer is that Kotlin code is safer and more concise than Java code, and that Kotlin and Java files can coexist in Android apps, so that Kotlin is not only useful for new apps, but also for expanding existing Java apps Since Kotlin offers a various utilities for programming and become more and more popular in the community, I think that it will be a trending in the future and why not take a step before that?
Trang 252.2.3 About Google Firebase
For our mobile application, I use Google Firebase as our database for easier app’s implementation and authentication progress’s simplification
What is Firebase?
Firebase is a toolset to “build, improve and grow your app”, and the tools it gives you cover a large portion of the services that developers would normally have to build themshelves, but don’t really want to build, because they’d rather be focusing on the app experience itself This includes things like analytics, authentication, databases, configuration, file storage, push messaging, and the list goes on The services are hosted in the cloud, and scale with little to no effort on the part of the developer.[10]
Firebase’s tools for building HoApp
- Firebase Authentication takes care of getting your users logged in and identified This product is essential to getting some of the other products configured properly, especially if you need to restrict access to per-user data It makes easy to perform secure logins, which is incredibly difficult to implement correctly on your own
- Firebase Realtime Database and Cloud Firestore provide database services, and both
tools can be considered as “realtime, cloud hosted, NoSQL databases” You use the client SDK to set up a listener at the location of the data your app wants to use, and the listener gets invoked with that data repeatedly, every time a change is observed This lets you keep your app’s display fresh, without having to poll the data of interest
- Cloud Storage provides massively scalable file storage It’s also technically a Google Cloud product, not a Firebase product With Cloud Storage for Firebase, you get client SDKs to use in your app that enable you to upload and download files directly to and from your Cloud Storage
Firebase’s pros and cons: Pros:
- Database options : Firestore and Realtime are database options one can choose to
build their product They both are cloud-hosted, NoSQL databases that are flexible and scalable in terms of size Realtime database provides developers with offline access and real time updates that enable them to work on responsive apps without internet
connectivity
- Free for beginners: The platform doesn’t charge for most of its services and requires
choosing a pricing plan only after reaching a certain amount of database memory It’s great for beginners who want to validate if the platform is good enough for their product
and don’t want to pay for all the services upfront
- Community : Firebase has well-prepared technical documentation that eases the work
with offered services and makes them more accessible for users You can find all the
Trang 26that the community around the products and the number of resources will only benefit
developers trying to find an answer to any problem
- Ease of integration : Finally, the ease of integration and quick setup The pre-made
APIs that the platform offers enable you to add new functionalities within just a few clicks Firebase requires little to no technical knowledge to start working on your product The simple UI makes it possible to implement functionalities like authentication to your app without major problems Working with Firebase there is no
need for complex configurations, so nearly anyone can set up the app – web or mobile
Cons:
- Data storage is inconvenient : Usually, you will use the Realtime Database as your
main storage, which isn’t always good The main problem is limited querying capabilities You can’t query for more than one key at a time and the service doesn’t provide a way to filter your data It’s because the whole DB is JSON file and it’s
nothing near the storage format of SQL
- Limited data migration : You don’t host the data because all data is hosted on
Firebase and it’s a major problem of using BaaS platforms as your app backend Unless Firebase provides a migration tool to enable easy transfer of user’s data, it strongly limits data migration It makes users dependent on the platform and in case of changing
the concept of backend base, there is no way to transfer the app to another source
- Android centered : Firebase doesn’t provide the same capabilities for Android and
iOS apps It is still more Android centered and it’s the one system that gets most of
dedicated services and facilities
FirebaseAuth
Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more
Firebase Authentication integrates tightly with other Firebase services, and it leverages industry standards like OAuth 2.0 and OpenID Connect, so it can be easily integrated with your custom backend [11]
Trang 272.2.4 Implement MoMo E-Wallet for payment
About MoMo E-Wallet: MoMo is an application which provides payment solution for
business units, allowing customers to pay services in multiple platforms In this project, MoMo is used to pay for products in user’s cart
MoMo available payment method: Payment Gateway(All in One), App-In-App
Payment, POS Payment and QR Code Payment Because I am implementing an Android app, so App-In-App Payment method is chosen
To implement MoMo, first I must have a MoMo business account to make association
This account will be used to manage transactions and integration information , store, merchant, The environment set for this account is “test”, and will change to “business” if all of information is verified, including merchant legal document For the “test” environment, if I implement successfully, the transactions won’t happen, instead I receive a message to announce the successful transaction Only account with “business” environment can do transactions
sub-For android app, I use Momo Mobile SDK and follow all steps to open MoMo and
confirm transaction Information in business account will be used in app MoMo also provides developers Icon URL and color code for easier implementation If users don’t have MoMo in their mobile, the app will direct them to Google Play to install MoMo
MoMo processing steps:
Step 1: The merchant use MoMo Mobile SDK to open MoMo and request payment Step 2: After user confirms payment in MoMo, the merchant receives a callback
Step 3: Merchant checks the callback and sends payment information to merchant server if callback is successful
Step 4: Merchant server verifies and sends full information to MoMo server
Step 5: MoMo server handles the information and sends transaction’s result to merchant Step 6: Merchant server receives the result from MoMo server, handles and returns the result to user to confirm the transaction
Step 7: MoMo server handles user’s confirmation and sends the result to merchant server
Trang 28
Figure 2.4 MoMo Processing Diagram [12]
Trang 292.2.5 Android Studio Profiler
Introduced in Android 3.0, Android Studio Profiler is developed as a tool for monitoring CPU and usage of memory, intercept network responses and observe power consumption with real-time data It is compatible with API level 21 or higher and can run on a mobile
device or emulator To open the Profiler in Android Studio, you choose View > Tool
Windows > Profiler or click Profiler Tool Button from the bottom of Android Studio
Figure 2.5 Profiler window in Android Studio
With the help of Profiler, I can observe our specific actions when debugging the application For example, when I click the app, a pink dot appears in Profiler which indicates the click time the duration of the click Or when swithcing from an activity to another activity, I can check the Profiler and view the current activity by observing Caribbean green line By using the start time of the pink dot and the green line, I know the start time of the click and the next page and calculate the loading time
Trang 303 System Analysis and Design3.1 Use case Diagram
Figure 3.1 Use case Diagram for HoApp
Trang 313.2 Use case Descriptions
Customer User Registration Register an account to use Account is
compulsory when using the app Can be done after filling all important information
app’s shopping functions
Change Password Modify the password in case they forgot or wanting another password
User Functions Access functions that are available to users
Search Products Enter the product’s name to the search bar to search its information
View Receipts Show the receipts that are generated after users made a purchase Each of the receipts can be viewed with more detail
View Products Information Show the products’s information in detail
Add Products to Cart Scan the products’s QR code to add them to the app’s cart
clicking “Edit”
View User Ranking Show the ranking of customers of the app based on their purchased products
Trang 32Check Out Make a payment, interact with products before paying
Customer
Modify Products in Cart Change attributes of products in cart
Change Products Amount in Cart
Increase or Decrease the amount of each products in cart
Delete Products in Cart Delete products by click “Delete” or decrease the amount to 0
Select Payment Method Choose the payment options for the order
Pay by MoMo in Store Use MoMo to pay for the order when shopping in store
Pay by MoMo online Use MoMo to pay for the order and the store will deliver the products to you
Pay by Cash in Store Use cash to pay for the order when shopping in store
Pay by Cash at home Pay for the order by cash when you receive it
Staff
app’s staff functions
Staff Functions Access functions that are available to staffs Get online Requests Get orders that needs to be sent to customers
when they make an online order
Trang 33before customers come to get them
or using cash
Admin
app’s admin functions
Admin Functions Access functions that are available to admins Search Products Enter the product’s name to the search bar to
search its information Admin can scan the product’s barcode to search its information Add new Products Fill in necessary information about new
products and add it to the database
View Products Information Show the products’s information in detail Edit Products Information Change the products’s information, usually
used when increasing product’s amount View Products Sales View the sales of products in month, year and
view sales of products for their categories
Trang 343.3 Flow Chart Diagrams
Trang 35Figure 3.4 Flowchart for Change password
- Search Products
Figure 3.5 Flowchart for Search Products
- View Product Information
Figure 3.6 Flowchart for View Product Information
- Add Product to Cart
Figure 3.7 Flowchart for Add Product to Cart
- View Receipts
Trang 36Figure 3.8 Flowchart for View Receipts
- Edit Profile
Figure 3.9 Flowchart for Edit Profile
- View User Ranking
Figure 3.10 Flowchart for View User Ranking
- Modify Products in Cart
Trang 37Figure 3.11 Flowchart for Modify Products in Cart
- Check Out
Figure 3.12 Flowchart for Check Out
* Staff Functions:
- Get Request from Customer
Figure 3.13 Flowchart for Get Request from Customer
Trang 38- Accept Payment from Customer
Figure 3.14 Flowchart for Accept Payment from Customer
* Admin Functions:
- Admin Search Products
Figure 3.15 Flowchart for Admin Search Products
- Admin Add a Product
Figure 3.16 Flowchart for Admin Add a product
- Admin View Product’s Information