Mobile QR-Code For Smart Checkout System Using SETM Algorithm

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 73

MOBILE QR-CODE FOR SMART CHECKOUT

SYSTEM USING SETM ALGORITHM

BY

VICTOR OKONKWO
NOU148298623

A project submitted to the Department of Computer Science, National Open


University of Nigeria in partial fulfilment of the requirements for the award of
Master of Science in Information Technology.

May 2021
Title

i
DECLARATION

I declare this research report was written by me with the supervision of DR. OGUDE U.C.,

information contained therein are from published and unpublished material and duly referenced in

this report.

STUDENT DATE
VICTOR OKONKWO _________________________

ii
iii
DEDICATION
All honour and glory is ascribed to the Almighty God

iv
ACKNOWLEDGEMENTS
Firstly my gratitude goes to God Almighty, who has been so merciful and generous to me throughout

my studies and life.

I thankfully acknowledge my supervisor Dr. Ufoma Ogude for his guidance throughout the period of

this research. I also express profound gratitude to Mr. and Mrs Nicholas Okonkwo for their

understanding and attention which helped me in concluding this work. I would also like to extend

warm thanks to my mentors, teachers, well-wishers and friends especially Pastor and Mrs Chris Ugo.

v
ABSTRACT

Checkout systems are mechanisms for customers to process their purchases from a retailer, this allows
the customers reveal all the items in their cart at the point of checkout so that the cashier can quantify
the items and the customer the total amount to be paid, then receipt is generated. In the cause of the
checkout process in retail stores, there have been cases of delay, where the customer have so much
items in their cart, this takes long for the cashier at the checkout point to go through the items one by
one, this have caused many customers to leave their cart without buying anymore as they ran out of
patience. Some retail stores would have to draft their staff from other roles to join in assisting the
cashiers so as to reduce the delay time, which most times affect other activities in the retail stores.
Sometimes the queue caused by the delay in the checkout process would be so long that people would
occupy so much space in the retail shops or malls. This research is therefore focused on the design of
a model for smart checkout to address this inefficiencies. A model for smart checkout application was
designed using the iterative design technique. The model designed comprises a local database that
contains the information of items in stock, the QR code generation SETM algorithm on android mobile
application. A web-based application and android application, was developed to manage stocks in the
retail stores and customer’s e-wallet account following the Waterfall Software Development Life
Cycle. Sublime Integrated Development Environment, MySQL server, Android Development Kit 8
constitute the programming environment. The application was evaluated against traditional checkout
process in a shopping mall, by comparing its efficiency with the traditional checkout process in retail
stores and shopping malls with the use of smart checkout application. The model presented in this
study would help reduce waiting time compared to traditional checkout process in retail stores, redue
cart abandonment, free up store staff to serve customers in other ways and is more flexible than cash
registers scanning items one by one.

vi
Table of Contents
Title ..................................................................................................................................i
DECLARATION.......................................................................................................... ii
CERTIFICATION .......................................................... Error! Bookmark not defined.
DEDICATION ..............................................................................................................iv
ACKNOWLEDGEMENTS ......................................................................................... v
ABSTRACT ..................................................................................................................vi
INTRODUCTION......................................................................................................... 1
1.1 Background to the Study................................................................................................................. 1
1.2 Statement of the Problem ................................................................................................................ 2
1.3 Motivation ....................................................................................................................................... 3
1.4 Aims and Objectives of the Study .................................................................................................. 3
1.5 Purpose of the Study ....................................................................................................................... 4
1.6 Significance for the Study............................................................................................................... 4
1.7 Scope of the Study .......................................................................................................................... 5
1.8 Organization of the Work ............................................................................................................... 6
1.8 Definition of Terms......................................................................................................................... 7
REVIEW OF LITERATURE ...................................................................................... 8
2.0 Introduction ..................................................................................................................................... 8
2.1 Self-checkout system ...................................................................................................................... 8
2.1.1 Advantages of self-checkout systems ........................................................................................ 9
2.1.2 Disadvantages of self-checkout systems .................................................................................... 9
2.2 Scanning while shopping .............................................................................................................. 11
2.3 Data Privacy Preserving Methods ................................................................................................. 12
2.3.1 Privacy Preserving Data Mining .............................................................................................. 12
2.3.2 Privacy Preserving Data Mining Tasks and Algorithms.......................................................... 12
2.4 Quick Response Code ................................................................................................................... 18
2.4.1 Features and Type of Quick Response (QR) Code .................................................................. 19
2.4.2 Application of Quick Response (QR) Code............................................................................. 20
2.5 Review of Closely Related Works ................................................................................................ 21
2.5.1 RFID Based Checkout system ................................................................................................. 21
2.5.2 Hybrid Checkout system .......................................................................................................... 21
2.5.3 Use of Barcode in medical packages ....................................................................................... 21
METHODOLOGY...................................................................................................... 23

vii
3.0 Introduction ................................................................................................................................... 23
3.1 Research Design............................................................................................................................ 23
3.1.1 Design of Experiment .............................................................................................................. 24
3.1.2 Variable Selection .................................................................................................................... 25
3.2 Research Methods ......................................................................................................................... 26
3.2.3 Implentation of QR Code smart checkout system ................................................................... 30
3.2.3.1 Android Mobile Application (Customer’s View) .............................................................. 30
3.2.3.2 Web POS Application (Cashier’s View) ........................................................................... 31
3.2.3.3 Database Design................................................................................................................. 32
3.4.1 Design of the Application ........................................................................................................ 33
3.4 Performance Evaluation ................................................................................................................ 36
DATA ANALYSIS, RESULTS AND DISCUSSION OF FINDINGS ................... 37
4.0 Introduction ................................................................................................................................... 37
4.1 QR Code smart checkout mobile for customers ........................................................................... 38
4.2 QR Code smart checkout POS Portal for retail store admin ......................................................... 42
4.3 QR Code smart checkout POS Portal for retail store cashier ....................................................... 43
4.4 Evaluation Results ........................................................................................................................ 46
4.4.1 Research Instruments ............................................................................................................... 46
SUMMARY, CONCLUSION AND RECOMMENDATION ................................ 47
5.0 Introduction ................................................................................................................................ 47
5.1 Summary ....................................................................................................................................... 47
5.2 Conclusion .................................................................................................................................... 48
5.3 Contribution to Knowledge........................................................................................................... 48
5.4 Recommendations ......................................................................................................................... 48
REFERENCES ................................................................................................................................... 49
APPENDIX ......................................................................................................................................... 52

viii
ix
LIST OF TABLES

Table Page

Table 3. 1 Description of Variables .................................................................................................... 25


Table 3. 2: Retail store staff and their access levels to the system database ...................................... 29
Table 3. 3: Retail store staff and the attributes they are not allowed to view ..................................... 29

LIST OF FIGURES

Figure Page

Figure 2. 1: Resource Access Stages (Source: Joseph, Laskov, Roli, Tygar, Nelson, Almeida &
Parida, 2013) ........................................................................................Error! Bookmark not defined.
Figure 2. 2: Quick Response Code Structure (Source: Joseph, Laskov, Roli, Tygar, Nelson, Almeida
& Parida, 2013) ....................................................................................Error! Bookmark not defined.

Figure 3. 1: Typical retail store arrangement ...................................................................................... 24


Figure 3. 2: Customer interaction using the traditional checkout system ........................................... 25
Figure 3. 3: QRCSC mobile application Customer checkout message .............................................. 30
Figure 3. 4: QRCSC mobile application Customer checkout code .................................................... 30
Figure 3. 5: QRCSC mobile application Customer scan item view ................................................... 30
Figure 3. 6: QRCSC mobile application Customer login view .......................................................... 30
Figure 3. 7: POS Portal with customer’s cart generated from checkout QR Code ............................. 31
Figure 3. 8: POS Portal to scan customer’s checkout QR Code ......................................................... 31
Figure 3. 9: QR Code smart checkout Database design...................................................................... 32
Figure 3. 10: Architectural Diagram for QCSC Application .............................................................. 33
Figure 3. 11: Flowchart for QR Code smart checkout system ............................................................ 34
Figure 3. 12: Use Case diagram showing customer’s interaction with the QR Code smart checkout
system ................................................................................................................................................. 35

Figure 4. 1: QR Code smart checkout software customer’s landing page .......................................... 38


Figure 4. 2: QR Code smart checkout being used by customer to add item to virtual cart ............... 39
Figure 4. 3: QR Code smart checkout customer’s virtual cart ............................................................ 40
Figure 4. 4: QR Code smart checkout Interface showing the checkout QR code generated by
customer. ............................................................................................................................................. 41
Figure 4. 5: Stocking Item on the smart checkout portal by the retail store admin ............................ 42
Figure 4. 6: POS view of QR Code smart checkout for cashier to scan customer’s checkout code. . 43

x
Figure 4. 7: Cashier scanning customer’s checkout QR Code............................................................ 44
Figure 4. 8: QR Code smart checkout POS portal with customer’s items moved from the customers
virtual cart. .......................................................................................................................................... 45

xi
CHAPTER ONE
INTRODUCTION
1.1 Background to the Study

Checkout systems provides the mechanism for closing transactions in retail stores and e-commerce
platforms either supervised, semi-supervised or not supervised and has three major steps: adding items
to cart, payment, and receipt generation. The customers add their choice item into their shopping cart,
at the point of checking out, the cashier scans the item’s barcodes where these exist, this is to ascertain
the price of the item and to record the sales of the item after checkout process. The checkout process
in retail store are usually integrated with the retail store inventor system. The retail inventory system
also provides early warning capability to item running out of stock, supports staff and retail store
facility management, facilitate planning, supports and stimulates research and trends analysis, supports
sales reporting (Yamarie, 2020).

To improve the quality of customer service around the globe, efforts are being made to recude the time
spent in checking out at the cashier stands using POS(Point of Sales) machines, barcode scanners and
ATM cards, to help stop unfair queuing systems, confusing in-store experiences and the long lines that
leave customers discouraged (Yamarie, 2020). The use of checkout systems comes with many
potential benefits. Importantly, checkout system can increase sales and can reduce shop lifting.
Checkout system can also assist with proper book keeping, and improve shopping workflows in
retailer’s stores. A well designed and implemented, checkout system can improve customers turn up,
and also to increase efficiency and reduce cost of sales (Alexandra, 2017).

Despite the checkout system in retail stores, there are several barriers that can hinder effective
customer relations and capture of customer behavior data for analysis. Till date, many shopping mall
are finding it difficult managing the bottle necks that comes with the traditional checkout systems.
Also, methodologies are still being designed to represent customer behavior pattern into computable
code and business intelligence analysis for forecasting and making business decisions.

This study proposes a QR Code Smart Checkout (QCSC) model. In order to guarantee faster and safer
checkout process and the secrecy of sensitive customer’s data domiciled in customer’s payment card
and mobile phone, this study involves the development of an application named QR Code Smart

1
Checkout (QCSC) application which was used to instantiate checkout process. The study also
compared the use of the application developed in this study for checking out in a retail store to the
traditional checking out system that uses bar code scanners and ATM Cards.

1.2 Statement of the Problem


In retail store day to day operations, customers have cases of delay, where the customer have so much
items in their cart, this takes long for the cashier at the checkout point to scan the barcode on the items
one by one, this have caused many customers to leave their cart without buying anymore as they ran
out of patience. Some retail stores would have to draft their staff from other roles to join in assisting
the cashiers so as to reduce the delay time, which most times affect other activities in the retail stores.
Sometimes the queue caused by the delay in the checkout process would be so long that people would
occupy so much space in the retail shops or malls. The existing checkout system models in retail stores
designed are inefficient and causes delay in checking out. This research, therefore focused on the
development of QR code smart checkout model that saves time, customer’s data are secured and makes
it easy to analyse customer behavour.

2
1.3 Motivation
The research topic was picked up by us at this time as the world is still recoverying from the global
pandemic, many shopping mall would want to increase patronage but would also like to have
reduced number of customers in the waiting per time in their shopping malls.

1.4 Aims and Objectives of the Study


The main aim of the study is to help reduce the number of customers waiting in shopping malls to be
attened at the point of checking out.

The specific objectives are to:

i. propose a QR code smart checkout model for retail stores


ii. design a QR code smart checkout android mobile application to instantiate the model for
checking out
iii. test QR code smart checkout in a retail store using the application developed in ii and

3
1.5 Purpose of the Study

1.5.1. Existing retail store checkout systems were reviewed. The three major shopping malls where
chosen considared (Spar checkout process, NEXT store checkout process and Shoprite checkout
process). In the course of reviewing the models, the flaws in each of the shopping malls were
highlighted. Taking into consideration the bottle neck in the existing checkout systems, a model for
QR code smart checkout process in retail stores was proposed. The proposed model consists of:
i. local database which have records of stocks
ii. the QR code generating and reading application
iii. android smart checkout mobile application
iv. e-wallet feature in the smart checkout mobile application
v. web application for administering the smart checkout process.
1.5.2. An application for QR code smart checkout process was built using the Waterfall Software
Development Life Cycle Model and the following tools were used:

i. Android Software Development Environment (SDK)


ii. MySQL server
iii. Sublime Code Editor
iv. Fireworks Image editor
Both models were evaluated for efficiency based on the quantum of time taken to select items into cart
and checking out. Hence, the better models for checking out in retail stores is the one which took less
time for customer to checkout in the retail store.

1.6 Significance for the Study


This study will bring to the fore, the need for retail stores to adopt QR code smart checkout model for
checkout instead of the existing checkout systems used by most of them which employs the use of bar
code scanner on every item one by one and different POS handheld for payment. The study when
implemented by the retail stores in Nigeria will help reduce the time spent in retail store and reduce
the crowd especially during the pandemic, it would also give store managers the access to customers
behavioural pattern as it relates to their as business analyst need to analyse customer demographics.
By implementing the QR code smart checkout model that was proposed in this study, the menace of
crowded retail stores would be reduced to a reasonable degree.

4
1.7 Scope of the Study

This study focused on faster way of checking out from a retail store. For the purpose of this study, two
retail stores were visited to gather the data required for the study. The two retail stores were Shoprite,
Ikeja, Lagos and Ebeano Supermarket, Ikeja, Lagos. They both have similer checkout process.

i) Number of staff and severs:

Nr =total number of registers in the shop (Nr >0)

S = total number of staff working in the shop (S >0),

Sr= number of staff who are fixed at the checkout

counter (Nr≧Sr≧0),

ii) Switching points (Threshold):

The switching point to decide when to open a new register with current staff is denoted as T0.

The number of customers waiting is used to set the threshold, which means if the waiting number of
the queue is more than T0, and there still has any available staff, he or she will open a new register to
serve the customer.

iii) Queuing mode:

The queuing mode: (1) customers standing in front of each register (QM1) and (2) customers standing
in a line (QM2) are examined in the simulation model.

In the case of QM1, the customer will try to pick a lane with the shortest wait time. We assume that
once a customer picks a lane, they remain in the lane. In the case of QM2, the customer will go to the
end of the queue.

iv) Output Data:

Customer average waiting time (Wa) and remaining free time for staff to do other jobs (Tf) are used
as output data to evaluate system performance.

The study used five customers in each retail store, from the time they moved their items to the cashier
to when they made payment and issued receipts issued.

5
1.8 Organization of the Work

This research report have five chapters, the chapter one introduces the topic by giving the
background of the study, aims and objectives, movtivation for the study and significance of the
study.
Chapter two is the review of related works.
Chapter three have Section 3.1 presents the research design describing the design of the experiment
and the selection of variables. Section 3.2 describes the research procedure, Section 3.3 describes the
checkout model design, and the proposed model for the QR code smart checkout is discussed in
Section 3.4.
Chapter four presents the results generated from the study. The study provides an efficient approach
for customer checkout in retail store using the model proposed in chapter three. Section 4.1 focuses
on customer using the QR Code smart checkout mobile application to add items to their virtual cart
and they simultaneously add the items to their physical cart, Section 4.2 focuses on the the retail store
manager adding stocks to the QR Code smart checkout POS, Section 4.3 focuses on the cashier
scanning the checkout QR Code generated by the customer to load items in the customer’s virtual cart
into the POS portal.
Chapter five have Section 5.1 presents the summary of the findings, Section 5.2 gives the contribution
to knowledge and Section 5.3 gives the recommendations and suggestions for further studies.

6
1.8 Definition of Terms
Checkout System: This refers to the system that payments for items bought by customers in
commerce enviroment.
POS Portal : This is Point of Sales portal used in retailers’ store to computes items bought, receive
payement and issue receipt.
Model: This is a representation of an idea, an object or even a process or a system that is used to
describe and explain phenomena that cannot be experienced directly.
Role Based Access Control: This is a policy for access control mechanism defined around roles and
privileges used to restrict system access to authorized users.
e Wallet: This is electronic wallet that holds unit with equivalent money values which is accessable
as the point of payment.

7
CHAPTER TWO
REVIEW OF LITERATURE

2.0 Introduction
Increasing awareness about the importance of time spent in checking out in a retail store and how it
affects customer patronage has led to increased research and discovery of methods that can help reduce
time spent in checking out in a retail store in a secure manner. Checking out fast with no queue has
been a long standing issue for retailers. Thus, self-checkout (also known as self-service checkout and
as semi-attended customer-activated terminal, SACAT) machines that provides a mechanism for
customers to process their own purchases from a retailer was introduced but without privacy protection
and shoplifting increased. They are an alternative to the traditional cashier-staffed checkout. The
customer act as the cashier themselves, by scanning the items barcodes and then make payment for
the items by inserting cash into the machine, or entering payment card information (Stevens S., Laura,
2019).
2.1 Self-checkout system

In self-checkout systems, the customers are required to:

 Scan barcodes of product where these exist


 Weigh products without barcodes (such as fresh produce) and select the variety from what is
displayed on a touchscreen.
 Scanned items are placed in "bagging area". The weight is taken from bagging area is verified
against previously stored information to be sure the correct item is bagged, allowing the customer
to proceed only if the observed and expected weights match (Stevens S., Laura, 2019).

Machines in different shopping malls may accept card via POS, debit/credit cards, electronic food
assistance cards, cash via coin slot, bank note scanner, and in-store gift cards (where applicable).
Most coupons also have barcodes and can be scanned the way the items are scanned, although some
require input from a member of staff (Stevens S., Laura, 2019).

There is usually a staff member supervising a group of self-checkouts who will assist customers when
required, and authorise the sale of age-restricted products such as medicines, alcohol, knives and
tobacco (Stevens S., Laura, 2019).

8
2.1.1 Advantages of self-checkout systems
One of the main advantage to the shopping mall in providing self-checkout machines is to reduced
cost of labour: a cashier can controll upto three checkout stands. The self-checkout machine size is
also smaller than a traditional checkout manned by a cashier; so this can help the shopping mall in
space saving, more selves, display cabinets or checkout stands can be place in the saved space.

Most customers who would prefere not to relate with the cashier would use the self-checkout.

Self-checkout is usually faster compared to using a traditional checkout system. There is great
reduction in the length of checkout lines and wait times. In a survey by NCR, 42% of customers said
they liked the convenience of self-checkout, while 39% said it was faster compared to the traditional
checkout system. 90% of those surveyed responded as being users of self-checkout, with 7% of
respondents saying they will always use self-checkout regardless of store lines and number of items.
Survey respondents in Italy and Australia said they "always use self-checkout" at a rate of 13% and
9% respectively (Stevens S., Laura, 2019).

One advantage is that self-checkouts can, if the necessary investment is made, provide a partly
multilingual service. (It cannot be fully bilingual unless the goods themselves are labelled in all the
relevant languages, which is often not the case.) For example, Tesco's Welsh stores which can serve
customers in Welsh, whereas finding enough fluent Welsh-speakers as staff can be difficult because
in some areas only a small proportion of local people have Welsh as their first language (Stevens S.,
Laura, 2019).

2.1.2 Disadvantages of self-checkout systems


Some of the major disadvantages of self-checkout systems include:
i) Stealing

Self-checkout is vulnerable to some stealing techniques. In some cases the machine will
pick up the attempt to steal, or cause the customer to change their behavior (e.g. an item
can be placed not on the scales but elsewhere where it should not be placed, and this may
be noticed by the system supervisor). For example, in 2007, a man was charged with
replacing the tag of a plasma TV with a $4.88 DVD, and trying to purchase it through self-
checkout (Stevens S., Laura, 2019).

9
Studies suggest that a large proportion of shoppers are tempted to shoplift due to the
relative ease of fooling self-checkouts. For example, a person who (initially without intent
to shoplift) does not scan an item, may remember that this was easy, and fail to scan other
items deliberately(Stevens S., Laura, 2019). A 2012 survey with 4,952 respondents in the
UK found that a third of shoppers had stolen this way, with a quarter of the remainder
stating they were deterred by the risk of detection. Non-barcode items such as produce, and
store staff overriding (or ignoring) checkout alerts, were singled out as vulnerabilities, and
poverty was not seen as a major factor (Stevens S., Laura, 2019).

The founder of one store video surveillance system estimated that "Theft intentional or not
is up to five times higher with self checkout than when cashiers are working", although
behaviour of shoplifters is becoming well known, and stores are now better at shoplifting
detection (Stevens S., Laura, 2019). A 2014 survey in Florida, of USA, 2,634 respondents
confirmed the same general findings, but commented that the cost of additional theft was
evidently seen as "tolerable" compared to the cost of other processes, such as manned
checkouts, and harm due to poorer customer service arising from the slowness of manned
versus automated checkouts (Stevens S., Laura, 2019).

ii) Customer effort


In 2002, a study was carried out where people with disabilities used self-checkout
machines, and found that existing checkout machines were not designed for accessibility
(Bajaj et al., 2006).
iii) Customer Interaction
Self-checkouts are also criticized for reducing the possibilities for customers and store staff
to interact, and adversely affecting customer service in general (Stevens S., Laura, 2019).
Self-checkout lanes may lack some rather basic customer interactions, like informing the
customer that a coupon was not accepted, and why (Stevens S., Laura, 2019).
iv) Noise Pollution
Customers have often complained about the repeated robotic-sounding messages coming
from self-service checkouts. In 2015, supermarket Tesco replaced the robotic
announcements with more human-sounding voice prompts (Chester, 2015).

10
Retailers have been known to use novelty voices for their self-service checkouts. For
example, discount store Poundland has used the voices of Yoda (Jedi, 2019), Elvis Presley,
Count Dracula and Father Christmas on various occasions (Kalia et al., 2019). In 2019,
Marks & Spencer replaced its regular checkout announcers with the voices of Ant
McPartlin, Declan Donnelly, Alisha Dixon and Amanda Holden during the 2019 edition of
Britain's Got Talent (Stevens S., Laura, 2019). The new voices led to an increase in
customer complaints about the automated system, with many questioning the
appropriateness of some of the comments (Kalia et al., 2019).

v) Low Reliability
Being more complex, self-checkouts are more prone to failure. For example, they use
scales to weigh goods in the bagging area, and, if the scale fails, the machine does not
work. Also, in a manned checkout lane, any simple problems like lack of receipt paper
would be immediately fixed by the operator, while self-checkouts may not be fixed for
quite some time. This lack of reliability can be compensated for by having excess lanes
available or enough staff on hand to perform immediate maintenance (Stevens S., Laura,
2019).They can also be prone to false “Unexpected item in bagging area” alerts when an
item that was scanned gets put into the bagging area and after that it comes up with a
message saying the item that was just placed was unexpected, or a coat flapping onto it and
causing the error that way (Stevens S., Laura, 2019).

2.2 Scanning while shopping


An alternative system (self-scanning) consists of a portable barcode scanner that is used by the
customer to scan and bag items while shopping (Zimmerman et al., 2011). When the customer has
finished shopping, the scanner is brought to a checkout kiosk, where the information from the barcode
scanner is downloaded to the kiosk, usually in conjunction with a customer loyalty card. The customer
pays and receives a receipt at the checkout kiosk. The integrity of the system is maintained through
the use of random audits or RFID. The Walmart-owned warehouse club, Sam's Club, allows customers
to download an app and scan items into their cart using a mobile application (Stevens S., Laura, 2019).
In summer 2018, Walmart China launched its Wechat-based "Scan and Go" program, allowing
customers to scan items into their carts without downloading another mobile app, while paying through

11
Wechat Payment or Alipay. The "Scan and Go"program carried 30% of all payments made in Chinese
stores, and even improved sales in certain markets by 10% (Stevens S., Laura, 2019).

In December 2016, Amazon announced a bricks and mortar store in Seattle under the name Amazon
Go, which uses a variety of cameras and sensors in order to see what customers are putting into their
shopping bags (Steven et al., 2016). The customers scan a QR code when they enter the store through
a companion app, which is linked to their Amazon.com account (Stevens S., Laura, 2019). When the
customer exits the store, the items in their bag are automatically charged to the account (Stevens S.,
Laura, 2019).

2.3 Data Privacy Preserving Methods


In literature on data privacy preservation, different methods are employed in ensuring that access to
sensitive data is restricted only to authorized persons. These methods include:
i. Privacy preserving data mining
ii. Identification, Authentication and Authorization (Dwork, Rothblum & Vadhan, 2010).

2.3.1 Privacy Preserving Data Mining


Privacy preserving data mining technique is enabled using various methods. To ensure the protection
of individual records from being re-identified, the data set is modified before its release. When the
data set is modified, an intruder cannot be certain about the correctness of re-identified data.
A favorable Privacy preserving technique must satisfy two main requirements called Privacy and
High data quality (Matwin, Zhan & Chan, 2013).
2.3.2 Privacy Preserving Data Mining Tasks and Algorithms
The major privacy preserving data mining tasks are:
i. Classification
ii. Clustering
iii. Association Rule Mining (Davidson et al., 2010)

Classification: Classification refers to the task of categorizing observations into classes. It involves
predicting a certain outcome based on a given input. In order to predict the outcome, an algorithm
processes a training set that contains a set of attributes and the respective outcome, usually called goal
or prediction attribute. The algorithm tries to discover relationships between the attributes that would
make it possible to predict the outcome. Next the algorithm is given a new data set, called prediction
set, which contains the same set of attributes, except for the prediction attribute which is yet unknown

12
(Gibert, Sanchez-Marre & Codina, 2010). The algorithm analyzes the input and produces a prediction.
Thus, classification generalizes known structure to apply to new data.
Classification Algorithms: There are a number of algorithms used for the classification task in data
mining. Some of these algorithms include:
i. Naïve Bayes Algorithm
ii. Bayesian Network Structure Learning Algorithm
iii. Decision Tree Algorithm (Aggarwal & Reddy, 2013).

i. Naïve Bayes Algorithm

Naïve Bayes is a simple but highly effective classifier. Its combination of simplicity and effectiveness
has led to its use as a benchmark by which other classifiers are measured. The Naïve Bayes classifier
applies to learning tasks where each instance x is described by a conjunction of attribute values and
the target function f(x) can take on any value from some finite set C (Barigou, Barigou & Atmani,
2012).

ii. Bayesian Network Structure Learning Algorithm


Bayesian Networks relax the attribute independence assumption of the Naive Bayes classifier,
capturing situations where dependencies between attributes affect the class (Scutari, 2014). A
Bayesian Network is a graphical model; the vertices correspond to attributes, and the edges to
probabilistic relationships between the attributes (Naive Bayes is thus a Bayesian Network with no
edges.) In the Bayesian Network, the probabilities associated with an attribute are dependent on the
parents of that attribute in the network (Barigou, Barigou & Atmani, 2012).

iii. Decision Tree Algorithm


A decision tree is a flowchart-like structure in which each internal node represents a test on an attribute,
each branch represents the outcome of the test and each leaf node represents a class label which
denotes a decision taken after computing all attributes (Ben-Haim & Tom-Tov, 2010). The paths from
root to leaf depicts classification rules. In decision analysis a decision tree and the closely related
influence diagram are used as a visual and analytical decision support tool, where the expected values
of competing alternatives are calculated (Barigou, Barigou & Atmani, 2012).
.

13
Clustering: Clustering is the task of grouping a set of objects in such a way that objects in the same
group referred to as a cluster are more similar to each other than to those in other groups or clusters
(Aggarwal & Reddy, 2013). Clustering can be classified as:
1. hard clustering in which each object belongs to a cluster or not
2. soft clustering (also called fuzzy clustering) in which each object belongs to each cluster to a
certain degree.
There are also other distinctions possible, these include:
i. Strict partitioning clustering in which each object belongs to exactly one cluster
ii. Strict partitioning clustering with outliers in which objects can also belong to no cluster, and are
considered outliers.
iii. Overlapping clustering (also called alternative clustering or multi-view clustering): This occurs
when objects belong to more than one cluster case, when hard clustering is employed.
iv. Hierarchical clustering: In this case, objects belong to both child and parent clusters.
v. Subspace clustering: This is hinged upon the fact that when overlapping clustering is employed,
within a uniquely defined subspace, clusters are not expected to overlap.

Clustering Algorithms: Clustering algorithms are classified into the following


i. Hierarchical clustering algorithm
ii. Partitioning clustering algorithm
iii. Spectral clustering algorithm
iv. Grid-based clustering algorithm
v. Density based clustering algorithm

i. Hierarchical Clustering Algorithm


A hierarchical clustering algorithm is any algorithm that produces a sequence of nested clusters,
ranging from singleton clusters of individual points to an all-inclusive cluster (Roux, 2015). One of
the attractions of hierarchical techniques is that they correspond to classifications that are very
common in the biological sciences such as kingdom, phylum, genus, species and so on. Another
fascinating feature is that hierarchical techniques do not assume any particular number of clusters.
Instead, any desired number of clusters can be obtained by cutting the dendrogram at the proper level.
Also, hierarchical techniques are sometimes thought to produce better quality clusters than the other
techniques (Barigou, Barigou & Atmani, 2012).

14
.
Examples of hierarchical clustering algorithms are Agglomerative Algorithms and Divisive
Algorithms.

ii. Partitioning Clustering Algorithm


Partition clustering algorithm splits the data points into k partition, where each partition represents a
cluster. The partition is done based on certain objective function. One such criterion functions is
minimizing square error criterion which is computed as,
E = Σ || p – mi ||2
where p is the point in a cluster and mi is the mean of the cluster. The cluster should exhibit two
properties, they are (1) each group must contain at least one object (2) each object must belong to
exactly one group. The major shortcoming of this algorithm is that whenever a point is close to the
center of another cluster, it gives poor result due to overlapping of data points (Han, Pei & Kamber,
2011). Examples of Partition clustering algorithms are Relocation Algorithms, K-medoids Methods,
K-means Methods, Probabilistic Clustering, and Density-Based Algorithms (Barigou, Barigou &
Atmani, 2012).
.

iii. Spectral Clustering Algorithm


Spectral clustering refers to a class of techniques which relies on the Eigen structure of a similarity
matrix. Clusters are formed by partition data points using the similarity matrix. Any spectral clustering
algorithm will have three main stages (He, Zhang, & Liu, 2015). They are:
1. Preprocessing: This deals with the construction of similarity matrix.
2. Spectral Mapping: This is centered around the construction of Eigen vectors for the similarity matrix
3. Post Processing: This deals with the grouping data points
The following are advantages of Spectral clustering algorithm:
1. Strong assumptions on cluster shape are not made.
2. Simple to implement.
3. Objective does not consider local optima.
4. Statistically consistent.
5. Works faster.

15
The major flaw in this approach is that it exhibits high computational complexity. Examples of this
algorithms are SM (Shi and Malik) algorithm, KVV (Kannan, Vempala andVetta) algorithm,
NJW (Ng, Jordan and Weiss) algorithm (Barigou, Barigou & Atmani, 2012).
.

iv. Grid-based Clustering algorithm


Grid based algorithm quantize the object space into a finite number of cells that form a grid structure
(Zhao, Shi, Liu & Fränti, 2015). Operations are done on these grids. The advantage of this method is
lower processing time. Clustering complexity is based on the number of populated grid cells and does
not depend on the number of objects in the dataset. The major features of this algorithm are:
1. No distance computations.
2. Clustering is performed on summarized data points.
3. Shapes are limited to union of grid-cells.
4. The complexity of the algorithm is usually O (Number of populated grid-cells)

v. Density Based Clustering Algorithm


Density based algorithms continue to grow the given cluster as long as the density in the
neighborhood exceeds certain threshold (Yu, Zhang &Wang, 2016). This algorithm is suitable for
handling noise in the dataset. The following points are enumerated as the features of this algorithm:
1. Handles clusters of arbitrary shape
2. Needs only one scan of the input dataset
3. Handle noise
4. Needs density parameters to be initialized.

Association Rule Mining: Association rule mining is a method for discovering interesting relations
between variables in large databases. It is intended to identify strong rules discovered in databases
using some measures of interestingness (Zhao & Petry, 2015).
The problem of association rule mining is defined as:

Let I = {i1, i2, …., in} be a set of n binary attributes called items.

16
Let D = {t1, t2, ……, tm} be a set of transactions called the database.

Each transaction in D has a unique transaction ID and contains a subset of the items in I. .

A rule is defined as an implication of the form:

X Y

Where X,Y are subsets of I and X intersection Y is an empty set. Every rule is composed by two
different sets of items, also known as itemsets, X and Y where X is the antecedent and Y is the
consequent.

Association Rule Mining Algorithms: Types of association rule mining algorithms include:
i. Artificial Immune System (AIS) algorithm
ii. SETM algorithm
iii. Apriori algorithm
iv. Frequent Pattern (FP) - Growth algorithm

i. AIS Algorithm
It focuses on improving the quality of databases together with necessary functionality to process
decision support queries. In this algorithm, only one item consequent association rules are generated,
which means that the consequent of those rules contain only one item (Al-Enezi, Abbod, & Alsharhan,
2010).

ii. SETM Algorithm (SET-oriented Mining of association rules)


In the SETM algorithm, candidate itemsets are generated on-the-fly as the database is scanned, but
counted at the end of the pass. This is followed by the generation of new candidate item sets in the
same way as in AIS algorithm, but the transaction identifier TID of the generating transaction is saved
with the candidate item set in a sequential structure (Kumbhare & Chobe, 2014). It separates candidate
generation process from counting. At the end of the pass, the support count of candidate item sets is
determined by aggregating the sequential structure.

17
iii. Apriori Algorithm
Apriori algorithm is used for frequent item set mining and association rule learning. The algorithm
uses a level-wise search, where k-item sets are used to explore (k+1)-item sets, to mine frequent item
sets from transactional database for Boolean association rules (Al-Maolegi & Arkok, 2014). In this
algorithm, a step known as candidate generation process in which frequent subsets are extended one
item at a time is used. Then groups of candidates are tested against the data. To count candidate item
sets accurately, Apriori uses breadth-first search method and a hash tree structure. It identifies the
frequent individual items in the database and extends them to larger and larger item sets as long as
those item sets appear sufficiently often in the database. Apriori algorithm determines frequent item
sets that can be used to determine association rules which highlight general trends in the database.

iv. FP-Growth Algorithm


FP-growth requires constructing FP-tree. For that, it requires two passes. FP-growth uses divide and
conquer strategy. It requires two scans on the database. It first computes a list of frequent items sorted
by frequency in descending order (F-List) and during its first database scan. In the second scan, the
database is compressed into a FP-tree (Alghamdi, 2011). This algorithm performs mining on FP-tree
recursively. With this algorithm, there is a problem of finding frequent item sets which is converted
to searching and constructing trees recursively. The frequent item sets are generated with only two
passes over the database and without any candidate generation process. There are two sub processes
of frequent patterns generation process which includes: construction of the FP-tree, and generation of
the frequent patterns from the FP-tree.

2.4 Quick Response Code


A QR-code is the most recognized barcode introduced by the Japanese company Denso-Wave in
1994(Li-Chuan, Chen-Li and Chang-Jer, 2012). It was developed initially for managing records in
vehicle parts productions but are now accepted and used in different industries. The main purpose for
creating the code as the name suggest “Quick Response” is to allow information encoded to be decoded
very fast. QR code is a two-dimensional barcode that allows data to be stored in vertical and horizontal
direction. It’s made up of black squares and some tiny lines arranged in a square or rectangle shape on
a white background which can be read by an imaging device such as a camera or a QR code reader
and processed using Reed–Solomon error correction until the image can be appropriately interpreted.

18
The information encoded is then extracted from patterns that are present in both horizontal and vertical
components of the QR code.
2.4.1 Features and Type of Quick Response (QR) Code

Figure 2. 2: Quick Response Code Structure

Source:http://qr.biz/articles/the_structure_of_qr_code/

There are different types of quick response code which includes:

 QR code Model 1 and 2: Original version of the QR code is Model 1 and the largest version

of Model 1 is 14 (73x73 modules) capable of storing 1,167 numerals. Model 2 largest version

is 40 (177x177 modules) capable of storing 7089 numerals. It’s an improvement on Model 1.

 Micro QR code: It is commonly found on product packaging and easy to print on smaller

surfaces because it has one position detecting pattern. A QR code requires at least 4 modules-

worth round it but this type is viable even as a 2 module. There are four versions the largest is

M4 (17x17 modules) and capable of storing 35 modules.

 iQR code: This type have the capacity to hold more information than the traditional QR code

and can be generated in a smaller square or rectangular shape. The maximum version is 61

(422x422 modules) which can store about 40,000 numerals.

19
 SQRC: Just like a regular QR code except it has a reading restriction function that allows it to

store private information.

 FrameQR: It has a frame area and can be used for promotional activities where letters and

images can be placed in the frame.

Other examples of two dimensional barcodes includes Data matrix, Maxicode, Aztec code, PDF417.

DataMatrix and QR code are well-known 2D barcode [ISO/IEC 18004:2000]. The most-used type of

two-dimensional barcodes is the QR code commonly used in Asia and predominantly in Japan (Li-

Chuan, 2012).

2.4.2 Application of Quick Response (QR) Code

Smartphone camera is used typically as a QR code scanner. Camera phones equipped with the QR

code reader application can scan the image of the QR code to display text, contact information, ring a

phone, connect to a wireless network and open a Uniform Resource Identifier (URI) in the telephone's

browser making it easy to carry out the task without manual input. Although it was developed and

used because it provides a quick and convenient way to track vehicles parts during manufacturing

process (Walker, 2011). Today, QR codes technology are used in a much broader context which

include; inventory application, entertainment and transport ticketing, product and loyalty marketing

and convenience-oriented applications designed for mobile-phone users (termed mobile tagging)(Kan,

Teng, and Chou, 2009, pp.253-257).

20
2.5 Review of Closely Related Works
2.5.1 RFID Based Checkout system

Radio Fequency Identification (RFID) was employed in by several experimental stores in China, it
uses a combination of RFID and cameras to determine which products a customer has picked. Upon
leaving, the customer passes through an RFID-reading gate and only has to pay the bill to checkout
(Stevens S., Laura, 2019).

2.5.2 Hybrid Checkout system

Suppliers like ITAB, NCR, Wincor-Nixdorf, and others have manufactured hybrid checkout systems
that allows the checkout counter to be switched between either a cashier operated mode or a customer
self-service mode (Stevens S., Laura 2019).

2.5.3 Use of Barcode in medical packages

As two-dimensional barcodes are not used on any medical device packages the FDA does not have
any regulations for the two-dimensional barcodes. The regulations that exist for conventional barcode
may be identical when QR codes are implemented on a medical device package. The one-dimensional
barcode used in the medical device package is used only for tracking and identification purpose but
the QR code carries the link for electronic IFU and more information. (Alvarez-Silva, I., 2010).

Some of the regulations that have to be followed by medical device companies regarding barcode are
discussed below.

i.) The finished barcode should have both machine-readable data (i.e. the data
contained in the bars and spaces of the barcode) and human readable
interpretation (barcode data printed as alpha-numeric character below the
barcode).
ii.) The primary barcode has to contain the data identifying the catalogue
number.
iii.) The minimum bar height should be the 15% of symbol length. Minimum
quiet zone must be greater than 10 times the x dimension. The human

21
readable font size should be 6 points and it has to be 0.03 inches apart from
the barcode.
iv.) Most of the package comprises of secondary barcode that also has different
set of standards and hold information such as lot number, expiration date
and quantity.
v.) The barcode-creating software should be approved by the regulatory
department in the company or should meet FDA standards.

vi.) The print quality should also be tested on test samples before the barcode is
released for a particular product.
vii.) The barcode can also be printed in a stepladder orientation in comparison
with the usual picket fence orientation, but the parameter varies when the
orientation of the barcode changes.

If QR code to be implemented in a medical device package, it might have similar regulation to follow.
The above regulations give a good idea about what kind of regulations can be expected for
implementation of QR code and also acceptable modifications to be made by the FDA. (Alvarez-Silva,
I., 2010).

22
CHAPTER THREE
METHODOLOGY

3.0 Introduction
The sections of this chapter are as follows: Section 3.1 presents the research design describing the
design of the experiment and the selection of variables. Section 3.2 describes the research procedure,
Section 3.3 describes the checkout model design, and the proposed model for the QR code smart
checkout is discussed in Section 3.4.
3.1 Research Design
Data gathering is an important aspect of many research. Data gathering involves the systematic
collection of information about the objects of a study (people, objects, phenomena) and about the
settings in which they occur (Aggarwal, 2013).
The design of the research is centered around the use of QR code technology on android mobile
application to scan items by customers in retail shops. The model is made up three stages:
i. Android Mobile Application (QR Code Smart Checkout) :
QR Code Smart Checkout mobile application (QCSC) is installed on the customer’s phone,
the QCSC has the feature of reading bar code and QR code of item that is scanned by the customer.
The customer pick an item from the shelve and scan with QCSC mobile application
After shopping, the customer clicks on generate QR Code
The customer goes to the Casheir for payment
ii. Cashier reads checkout QR code :
The cashier reads the generate QR Code on the customer android application,
The items scanned by the customer is populated automatically in the Casheir’s POS application
The cashier then receives payment.
iii. Pay from Application e-Wallet
The customer can decide to pay from his/her eWallet on the QCSC mobile application

23
Figure 3. 1: Typical retail store arrangement

3.1.1 Design of Experiment


In the course of this research, the dataset for this study was collected from two retailers’ malls in
Nigeria, Shoprite in Ikeja, Lagos State and Ebeanor Shopping Mall in Ikeja, Lagos State. Both retailers
uses attendance for their checkout process. Figure 3.2 below show customer’s interaction using the
traditional checkout systems
Sixteen random customers in both retail stores where used to simulate the time spent in checking out.
Figure 3.1 above shows the cashier/register postion of the retail stores. Seven from Shoprite and Nine
from Ebeanor Shopping Mall, this was done using the steps below;
i. Have a meeting the store manager and explain the reason for a research and get permission
ii. Approch a customer who is about entering the retail store,
iii. Explain to them the research that is going on, and how they would participate
iv. Start a stop watch and note the time it takes for the customer to get to the checkout stand
and the time it takes to receive receipt and leave the checkout stand.

24
Figure 3. 2: Customer interaction using the traditional checkout system

3.1.2 Variable Selection


The selection of variables for this study was based on retailer malls within metroplitian city of Ikeja
that used POS system for checking out and customers avalible at the period of the research.
Table 3. 1 Description of Variables
Serial Number Variable Name Variable Format Variable Type
1 Name Continous
2 Gender Male, Female Categorical
3 Time spent in checkout Continous
4 Do you prefer the smart checkout Yes, No Categorical

25
3.2 Research Methods

3.2.1 Method of Proposed Model for Checking out


Having understudied the traditional checkout model discussed earlier and identifying its bottle
necks, a model for implementing smart checkout in a retail stores is proposed.
The model includes the following:
i. a database that contains the stock information
ii. the SET-oriented Mining of association rules (SETM) algorithm for generating checkout
QR code by customers
iii. a module for scanning barcode and QR code from items by customers
iv. a module for scanning checkout QR code by cashier from customer’s phone
v. a module for e-Wallet payments.

3.2.2 Method to Design and Develop a Prototype Application for QR Code Smart Checkout
An android mobile application for smart checkout in a retail store named QCSC was built employing
the Waterfall Software Development Life Cycle Model because the Waterfall model makes use of
sequential steps and does not include overlapping stages. This means the Waterfall Software
Development Life Cycle Model begins and ends one stage before starting
the next one. The Waterfall model consists of five stages namely i. Preliminary Survey ii. System
Analysis iii. Design iv. Implementation v. Review and Maintenance.

i. Preliminary Survey: At this stage of the model, some enquiry is made as regards what the
outcome of the survey should be. The preliminary survey stage examines the problem that
has informed the adoption of the Waterfall Software Development Life Cycle Model and
verifies if the problem is worth solving.

ii. System Analysis: At this stage, the requirements for building the application are identified.
There are two major types of requirement in software engineering which are Functional
requirements and the Non-Functional requirements. The functional requirements refer to
those requirements that are needed for the application to meet the purpose for which it was
designed. In this study, these requirements include the Java Programming Environment,
the platform, the hardware requirements and the software requirements. The non-functional

26
requirements refer to those requirements that are needed to enable the application perform
some other functions different from the primary purpose for which it was created.

iii. Design: The design stage involves defining how the software would be built such that it
would be able to achieve the purpose for its design.

iv. Implementation: This stage involves the translation of the architecture designed for the
application into the real application which is a collection of different computer programs.
At this stage also, the software is used to perform its basic function which is to preserve
patient data privacy.

The following software requirements for the application development are:

1. Operating System (Windows 8 Professional)


2. Netbeans Integrated Development Environment (IDE) whose text editor was used to write
the Java programming codes and whose compiler was used in compiling the written codes
3. MySQL server which was used to create as well as query the database
4. Java Development Kit (JDK) 8 which consists of a runtime environment as well as the tools
needed by developers to compile, debug and run applets and applications written in Java
programming language.
5. Android Development Kit (SDK) which consists of a runtime environment as well as the
tools needed by developers to compile, debug and run applets and applications written in
Java programming language.
6. scenebuilder 2.0 which is a Java framework that was used to design the Graphical User
Interfaces (GUIs) in the application. The scenebuilder 2.0 was used over netbeans to pick items
or components and drop onto a canvas such components include buttons, dropdowns, textboxes
and tableviews.
7. Navicat 8 query editor which was used to create and edit Structured Query Language (SQL)
text for queries, as well as to prepare and execute selected queries
8. JavaFX which is a Graphical User Interface (GUI) library that enables developers to design,
create, test, debug, and deploy rich client applications that operate consistently across diverse
platforms

The hardware requirements are:

27
Memory (1GB upward)

Hard Drive (10 GB upward)

Wired/Wireless Ethernet support.

For each new xml file created in scenebuilder, a controller class has to be generated for it by JavaFx
8 and the controller’s file extension is. java. The controllers interact with the data in the MySQL server
and the xml files created in the scenebuilder to produce the GUIs which are displayed to the user upon
request. The GUIs that can be displayed by the QCSC include the authentication page, the Item Scan
page, the customer’s view of item cart page, the cashier’s view of customer’s cart data and the cashier’s
view of scan customer’s checkout QR code based on the attributes each role category of retailer’s staff
and customer is allowed to see.

v. Review and Maintenance: At this stage, a thorough assessment of the application is done based on
its capability and if there is the need to add more functionalities to the software it is done. The
application needs to be maintained by a software engineer periodically who makes the needed
upgrades that will enable the application meet evolving user demands.

To implement smart checkout in a retail store checkout systems using an application developed, this
study employed the Mandatory Access Control (MAC) to assign access rights for retail store staff to
customer’s data based on their roles within the retail store. The dataset used for this study was gathered
from two retail stores which are Shoprite, Ikeja, Lagos and Ebeanor Shopping Mall, Ikeja, Lagos State.
The dataset was named QRCSC dataset and consists of 16 records and 4 attributes. This formed the
database of the application.
Based on information gotten from two store managers of the retail stores, it was discovered that when
a customer stay too long on the checkout queue, they lose patience and satisfaction, this usually affect
customers’ come back experience. However, the certainty that a dissatisfied customer would come
back next time cannot be guaranteed.

28
Graphical User interfaces were generated to show the view of each retail store staff to customer data.

Table 3. 2: Retail store staff and their access levels to the system database

Retail store staff Access Level


Store Manager Level 1
Store Keeper/Logistics Manager Level 2
Cashier Level 3
Social worker Level 4

Table 3. 3: Retail store staff and the attributes they are not allowed to view

Retail store staff Attribute blocked


Store Manager None of the three
Store Keeper/Logistics Manager Gender, Credit Card Type
Cashier Gender, Name, Credit Card Type
Social worker All

29
3.2.3 Implentation of QR Code smart checkout system
The proposed model aims at faster and more secured customer checkout in retail stores.
The three major components of the proposed QR code smart checkout system are;
i. Android Mobile Application for the Customer to use in scanning items into their their
virtual cart while they load their physical cart with same item as seen in Figures 3.4, 3.5
and 3.5.
ii. POS Application to manage stocks and read customer’s check QR code generated as seen
in Figures 3.6, 3.7 and 3.8.
iii. Database that holds the stocks and their attributes (weight, size and price) and also holds
sales records
3.2.3.1 Android Mobile Application (Customer’s View)

Username Video capture


Item’s QR Code
Password using the phone
camera
Login Button

Button to add
item to Cart

Figure 3. 3: QRCSC mobile application Figure 3. 6: QRCSC mobile application


Customer login view Customer scan item view

List of Item on
customer’s cart
Checkout
Message

Button to Generate
Checkout QR Code

Figure 3. 4: QRCSC mobile application


Figure 3. 5: QRCSC mobile application
Customer checkout message
Customer checkout code

30
3.2.3.2 Web POS Application (Cashier’s View)

Pay with
List of Item in eWallet
customer’s cart button
Scan Customer’s
Generated Code Pay with
ATM/Cash
Total Price of Item in
button
customer’s cart

Enter Discount

Figure 3. 8: POS Portal to scan Figure 3. 7: POS Portal with customer’s


customer’s checkout QR Code cart generated from checkout QR Code

31
3.2.3.3 Database Design

Figure 3. 9: QR Code smart checkout Database design


The proposed model for QR Code smart checkout in a retail store would be designed using the
database design as seen in Figure 3.9 above.

32
3.4.1 Design of the Application

Figure 3. 10: Architectural Diagram for QCSC Application

33
Figure 3. 11: Flowchart for QR Code smart checkout system

34
Welcome

Scan Item as you add to cart

Generate checkout QR Code


Customer

Login to POS portal

Read checkout QR code

Select payment choice


Cashier

Pay with ATM Card

Pay from e-Wallet

Pay with cash


Customer

Figure 3. 12: Use Case diagram showing customer’s interaction with the QR Code smart checkout
system

35
3.4 Performance Evaluation
This study used several methods for comparing traditional checkout system with the smart checkout
system based on the quality criterion, process yield. Tests for comparing two yield-measure indices,
based on the normal approximation and generalised confidence intervals method, are presented and
compared.

36
CHAPTER FOUR
DATA ANALYSIS, RESULTS AND DISCUSSION OF FINDINGS

4.0 Introduction
This chapter presents the results generated from the study. The study provides an efficient approach
for customer checkout in retail store using the model proposed in chapter three. Section 4.1 focuses
on customer using the QR Code smart checkout mobile application to add items to their virtual cart
and they simultaneously add the items to their physical cart, Section 4.2 focuses on the the retail store
manager adding stocks to the QR Code smart checkout POS, Section 4.3 focuses on the cashier
scanning the checkout QR Code generated by the customer to load items in the customer’s virtual cart
into the POS portal.

37
4.1 QR Code smart checkout mobile for customers

Figure 4. 1: QR Code smart checkout software customer’s landing page


Figure 4.1 shows the QRCSC mobile interface after the customer login, with the scan button
customer can scan item into into their virtual cart as they add the items physically to their.

38
Figure 4. 2: QR Code smart checkout being used by customer to add item to virtual cart
It displays the QRCSC interface which shows the application using the camera of the customer’s
phone of to scan item.

39
Figure 4. 3: QR Code smart checkout customer’s virtual cart
Figure 4.3 shows the list of items that have been scanned and added by customer on their virtual cart.

40
Figure 4. 4: QR Code smart checkout Interface showing the checkout QR code generated by
customer.
Figure 4.4 shows the QR Code smart checkout interface after the customer click “checkout”, the
checkout QR code is generated for the cashier to scan the QR code checkout generated by the
customer, after that, the items in the customer’s virtual cart is avalible on the cashiers POS portal.

41
4.2 QR Code smart checkout POS Portal for retail store admin

Figure 4. 5: Stocking Item on the smart checkout portal by the retail store admin
Figure 4.5 displays the QR Code smart checkout retailer’s portal interface which shows Items been
stocked by the retail store admin. The checkout portal generates QR code for each Item as they are
created.

42
4.3 QR Code smart checkout POS Portal for retail store cashier

Figure 4. 6: POS view of QR Code smart checkout for cashier to scan customer’s checkout
code.
Figure 4.6 shows the cashier POS portal interface before the cashier scans the customer’s checkout
code from the customer’s QR Code smart checkout mobile application..

43
Figure 4. 7: Cashier scanning customer’s checkout QR Code
Figure 4.7 displays the QR Code smartcheckout portal interface which would be used by the cashier
to scan checkout QR Code generated by the customer. This would automatically copy all items in

44
the customer’s virtual cart in the QR Code smart checkout mobile application into the cashier’s POS
portal, this happends in less than one second.

Figure 4. 8: QR Code smart checkout POS portal with customer’s items moved from the
customers virtual cart.
Figure 4.8 shows the list of items from the customer’s virtual cart after the cashier scans customer’s
checkout code, it load all item in the customer’s virtual cart to the cashier’s POS portal in less than a
second and automatically computes the total to cost of the items.

45
4.4 Evaluation Results
4.4.1 Research Instruments
For the purpose of this research study we did a smapling on sixteen customers with method
as stated in Chapter 3, section 3.1.1 (Design of Experiment)
Table 4. 4 Distribution of customers in this study based on demographic characteristic variation
number percentage.
Demographic Variation Frequency Average Time Esti. Avgr Preferred QRCSC
Characteristic Spent Time with QRCSC for checking out
Gender Male 6 4
Female 10 8
Marital Status Single 5 5
Married 11 7
Education Background Illirate 2 1
Educated 14 11
Age of Customer Under 20 yrs 0
20-40 12 10
40-60 8 2
Above 60 0
Shopping Mall Shoprite, Ikeja, Lagos 7 27mins 16mins 6
Ebeano, Ikeja, Lagos 9 32mins 23mins 10

46
CHAPTER FIVE

SUMMARY, CONCLUSION AND RECOMMENDATION

5.0 Introduction
The use of traditional checkout systems in the retail store has made managing the retail store easy
however there are still issues that raises from delay in attending to customers ready to checkout due to
the approach used by the traditional retail store checkout system, it is expedient that a smart checkout
system is adopted this takes the scanning items bar code in customer’s cart one by one of the cashier.
Section 5.1 presents the summary of the findings, Section 5.2 gives the contribution to knowledge and
Section 5.3 gives the recommendations and suggestions for further studies.

5.1 Summary
This study addressed the inefficiencies with the traditional checkout system in the retail store. The
first approach involved the use of QR Code smart checkout android mobile application by the
customers to scan items into their virtual cart while they put the item in their physical cart, then they
generate a checkout code by clicking the “checkout” button. This check out code it then taken to the
cashier who then scans the checkout code, the system automatically load all items in customers virtual
cart into the cashier’s POS portal, then time is save. Customers can either pay from their e-wallet on
the QRCSC mobile application using their ATM card or with cash. To evaluate the efficiency of the
smart checkout system over the traditional checkout system, a simulation was done. Two customers
walking to a retailers store and their interactions where timed. One was assumed to a used the smart
checkout system, at point the cashier was scanning the items of the customer one by one (this took 5
minutes) while the simulated situation is 4 seconds. The efficiency of each of the two approaches was
then computed as a function of the time elapsed in checking out. A decision is then reached as regards
the more efficient of the two approaches based on the findings of this study.

47
5.2 Conclusion

This study reviewed the traditional model for checking retail stores and compared with the QR Code
smart checkout model. Conclusively, the QR Code smart checkout model is faster by cutting the time
is take for the cashier to scan each item one by one.

5.3 Contribution to Knowledge


This research contributes to knowledge by providing a viable alternative to checking out in retail
stores. The application built provides interested parties with the opportunity to have access to the
source codes for the application through which they can modify the application viz-a-viz their
checkout process needs. This becomes worthy of mentioning since the QR Code smart checkout
software has its source codes inaccessible to prospective users but limit users only to the functionalities
available within the software by the developer’s design thus making it almost impossible for a user to
modify the software to meet evolving needs with respect to the specification of the user. The study
also provided a model for smart checkout that can be adopted by other researchers to tackle the issue
of delay in checking out with respect to their peculiar need.

5.4 Recommendations
This research has brought to bear the need for adopting the use of smart checkout systems in retail
store in countries like Nigeria. The study therefore recommends the adoption of QR Code smart
checkout system in Nigerian retail stores to decongest the crowd always found in retail store without
reducing sales. This study also recommends a concerted effort on the part of the administration of the
retail stores in Nigeria to ensure that cashiers are adequately trained on the use of the smart checkout
technology and subsequently monitored to ascertain that they use the technology. This will go a long
way in improving the quality of service delivery the Nigerian commerce sector provides to its
citizenry.

48
REFERENCES

Aggarwal, C. C., & Reddy, C. K. (Eds.). (2013). Data clustering: algorithms and applications.
Warsaw: CRC Press.

Al-Enezi, J. R., Abbod, M. F., and Alsharhan, S. (2010). Artificial Immune Systems-models,
algorithms and applications. Chichester: John Wiley & Sons.

Alexandra Sheehan (2017). Simple customer service tips all retailers should try. Retrived August 16,
2020 from https://www.shopify.com.ng/retail/ideas-to-kill-more-costs-without-killing-product-
quality.

Alghamdi, A. S. A. (2011). Efficient Implementation of FP Growth Algorithm-Data Mining on


Medical Data. International Journal of Computer Science and Network Security, 11(12), 7-16.

Al-Maolegi, M., and Arkok, B. (2014). An improved Apriori algorithm for association rules.
International Research Journal of Computer Science and Application, 1(1), 1-8

Alvarez-Silva, I., Alvarez-Silva, S., and Alvarez-Rodriguez, J. (2010). Positive syndrome of


schizophrenia and epilepsy. Medical hypotheses, 74(2), 294-296.

Anwander, M., Hurni, P., Staub, T., Wagenknecht, G., and Braun, T. (2013). A secure remote
authentication, operation and management infrastructure for distributed wireless sensor
network testbeds. Electronic Communications of the EASST, 17, 1-12.

Barigou, F., Barigou, N., and Atmani, B. (2012). Spam Detection System Combining Cellular
Automata and Naïve Bayes Classifier. In ICWIT, 250-260.

Bajaj K., Mirka G. (2006). Evaluation of a Redesigned Sel-Checkout Station for Wheelchair Users. J
Assistive Technology, 15-24.

Ben-Haim, Y., and Tom-Tov, E. (2010). A streaming parallel decision tree algorithm. Journal of
Machine Learning Research, 11(2), 849-872.

Chester, Tom (2015). Tesco replacing irritating self-checkout robo-voice. Mashable UK. Retrived
August 23, 2020 from: https://mashable.com/2015/07/30/tesco-self-checkout-
voice/?europe=true.

Davidson, J., Liebald, B., Liu, J., Nandy, P., Van Vleet, T., Gargi, U., & Sampath, D. (2010). The
YouTube video recommendation system. In Proceedings of the fourth ACM conference on
Recommender systems, 293-296. ACM.

49
Dwork, C., Rothblum, G. N., & Vadhan, S. (2010). Boosting and differential privacy. In
Foundations of Computer Science (FOCS), 2010 51st Annual IEEE Symposium on (pp. 51-
60). IEEE.

Ennahbaoui, M., & Elhajji, S. (2013). Study of access control models. In Proceedings of the World
Congress on Engineering, 2, 3-5.

Gibert, K., Sanchez-Marre, M., and Codina, V. (2010). Choosing the right data mining technique:
classification of methods and intelligent recommendation (Doctoral dissertation, International
Environmental Modelling and Software Society).

Jedi, M. (2019). Yoda is set to help out at the tills at Ballymena’s Pundland – he must! The
Ballymena Daily. Retrived from: https://ballymenadaily.com/local-news/jedi-master-yoda-is-set-
to-help-out-at-the-tills-at-ballymenas-poundland-he-must/ on August 27th, 2020.

Kalia, Ammar (2019). Chummy automation: why no one want Ant and Dec to voice the M&S tills.
The Guardian. Retrived from:
https://www.theguardian.com/media/shortcuts/2019/apr/23/chummy-automation-why-no-one-
wants-ant-and-dec-to-voice-the-ms-tills on August 27th, 2020.

Kan, T. W., Teng, C. H., and Chou, W. S. Applying QR code in augmented reality
applications, Conference on Virtual Reality Continuum and Application in
Industry, p253-257(2009).

Kumbhare, T. A., and Chobe, S. V. (2014). An Overview of Association Rule Mining Algorithms.
International Journal of Computer Science and Information Technologies, 5(1), 927-930.

Li-Chuan, C., Chen-Lin, L., & Chang-Jer, W. (2012). Applying QR Code Technology to
Facilitate Hospital Medical Equipment Repair Management, International
Conference on Control Engineering and Communication Technology, pp. 856-
857.

Matwin, S., Zhan, J., and Chang, L. (2013). Privacy-preserving collaborative association rule
mining. In IFIP Annual Conference on Data and Applications Security and Privacy, 153-165.
Springer Berlin Heidelberg.

Moosavi, V., Khan, G. D., & Rose, S. D. (2015). U.S. Patent No. 9,135,429. Washington, DC: U.S.
Patent and Trademark Office.

Rosic, D., Novak, U., and Vukmirovic, S. (2013). Role-based access control model supporting
regional division in smart grid system. In Computational Intelligence, Communication
Systems and Networks (CICSyN), Fifth International Conference, 197-201. IEEE.

Roux, M. (2015). A comparative study of divisive hierarchical clustering algorithms.


International Journal of Computer Science and Engineering Communications, 3(3), 56-71

50
Scutari, M. (2014). Learning Bayesian networks with the bnlearn R package. Journal of Statistical
Software, 35(3), 1-21

Stevens S., Laura (2019). Self-checkout Wikipedia. Retrived August 5, 2020, from
https://en.wikipedia.org/wiki/Self-checkout#cite_note-:0-1

Vaishnavi, V., and Kuechler, W. (2004). Design research in information systems.


www.isworld.org/researchdesign/drisISworld.htm. Retrieved 15/6/2020.

Walker, J.D. (2011). ‘QR Codes Are the Next Marketing Wave,’ Courier-Tribune, the
(Asheboro, NC). News Bank Access World News. [Online]. Available at:
http://asheboro.couriertribune.com/local_news/story/2011/10/06/qr_codes_are_
next_marketing_wave (Retrieved: 03 June 2020).

Yu, H., Zhang, C., and Wang, G. (2016). A tree-based incremental overlapping clustering method
using the three-way decision theory. Knowledge-Based Systems, 91, 189-203.

Yamarie Grullon (2020). Simple customer service tips all retailers should try. Retrived August 5,
2020, from https://www.shopkeep.com/blog/retail-customer-service-tips.

Zimmerman, Ann (2011). Check Out the Future of Shopping. Wall Street Journal, Retrived August
17, 2020, from
https://www.wsj.com/articles/SB10001424052748703421204576329253050637400

Zhao, L. and Petry, F. E (2015). Data mining by attribute generalization with fuzzy hierarchies in
fuzzy databases. Fuzzy Sets and Systems, 160(15), 2206-2223.

Zhao, Q., Shi, Y., Liu, Q., and Fränti, P. (2015). A grid-growing clustering algorithm for geo-spatial
data. Pattern Recognition Letters, 53, 77-84.

51
APPENDIX

EXCERPT OF THE JAVA PROGRAMMING CODES FOR THE ANDROID MOBILE


APPLICATION, QR CODE SMART CHECKOUT (QRCSC)
package com.haggle.smartcheckout;

import android.Manifest;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;

52
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface;
import android.webkit.PermissionRequest;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


WebView simpleWebView;
public String NewMsg;
private ValueCallback<Uri> mUploadMessage;
public ValueCallback<Uri[]> uploadMessage;
public static final int REQUEST_SELECT_FILE = 100;
private final static int FILECHOOSER_RESULTCODE = 1;
//@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
//@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Toolbar toolbar = findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);
// ActionBar actionBar = getSupportActionBar();
// actionBar.hide();
simpleWebView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = simpleWebView.getSettings();

webSettings.setJavaScriptEnabled(true);
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
webSettings.setPluginState(WebSettings.PluginState.ON);
webSettings.setAllowFileAccess(true);
webSettings.setDatabaseEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowContentAccess(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(false);

//webSettings.setMediaPlaybackRequiresUserGesture(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
webSettings.setAllowUniversalAccessFromFileURLs(true);
webSettings.setAllowFileAccessFromFileURLs(true);

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
webSettings.setMediaPlaybackRequiresUserGesture(false);
}

53
webSettings.setGeolocationEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setAppCacheEnabled(true);

webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
simpleWebView.setWebViewClient(new MyWebViewClient());
//simpleWebView.loadUrl("https://busticket.com.ng/mobile/index.html");
simpleWebView.addJavascriptInterface(new
WebViewJavaScriptInterface(this.getApplicationContext()), "AppWorks");
if (hasNoPermissions()) {
requestPermission();
}
// simpleWebView.loadUrl("https://www.elshcon.space");
/* FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action",
Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}); */

simpleWebView.setWebViewClient(new MyWebViewClient()
{

public void onPermissionRequest(final PermissionRequest request) {


// L.d("onPermissionRequest");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
request.grant(request.getResources());
}
}
// For 3.0+ Devices (Start)
// onActivityResult attached before constructor
protected void openFileChooser(ValueCallback uploadMsg, String acceptType)
{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}

public void onReceivedError(WebView simpleWebView, int errorCode, String


description, String failingURL)
{
try{
simpleWebView.stopLoading();
} catch (Exception e)
{

if(simpleWebView.canGoBack())

54
{
simpleWebView.goBack();
}

simpleWebView.loadUrl("file:///android_asset/index.html");
// simpleWebView.loadUrl("https://busticket.com.ng/mobile/index.html");

AlertDialog alertDialog = new


AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Error");
alertDialog.setMessage("Check Your Internet Connection");
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Try Again", new
DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which){
finish();
startActivity(getIntent());
}
});

alertDialog.show();
super.onReceivedError(simpleWebView, errorCode, description,
failingURL);
}

/////////////////////////////////////

});

simpleWebView.setWebChromeClient(new WebChromeClient()
{
public void onPermissionRequest(final PermissionRequest request) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
request.grant(request.getResources());
}
}
/*
public void onProgressChanged(WebView view, int progress) {
if(progress < 100 && mProgressBar.getVisibility() == ProgressBar.GONE){
mProgressBar.setVisibility(ProgressBar.VISIBLE);
// txtview.setVisibility(View.VISIBLE);
}

mProgressBar.setProgress(progress);
if(progress == 100) {
mProgressBar.setVisibility(ProgressBar.GONE);
// txtview.setVisibility(View.GONE);
}
} */
///////////////////////////////////////////////////////////////

//The undocumented magic method override


//Eclipse will swear at you if you try to put @Override here

55
public void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback) {
// callback.invoke(String origin, boolean allow, boolean remember);
callback.invoke(origin, true, false);
}

// For Android 3.0+


public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
MainActivity.this.startActivityForResult(Intent.createChooser(i, "File
Browser"), FILECHOOSER_RESULTCODE);
}

//For Android 4.1+ only


protected void openFileChooser(ValueCallback<Uri> uploadMsg, String
acceptType, String capture)
{
mUploadMessage = uploadMsg;
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(Intent.createChooser(intent, "File Browser"),
FILECHOOSER_RESULTCODE);
}

protected void openFileChooser(ValueCallback<Uri> uploadMsg)


{
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"),
FILECHOOSER_RESULTCODE);
}

// For Lollipop 5.0+ Devices


public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri[]>
filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}

uploadMessage = filePathCallback;
Intent intent = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intent = fileChooserParams.createIntent();
}
try {
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e) {

56
uploadMessage = null;
Toast.makeText(getApplicationContext(), "Cannot Open File Chooser",
Toast.LENGTH_LONG).show();
return false;
}
return true;
}

/*@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult
result) {

Log.d("LogTag", message);
result.confirm();
return true;
}
*/
////////////////////////////////////////////////////////////////

/////////////////////////////////////////

});

simpleWebView.loadUrl("file:///android_asset/index.html");

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

57
public class WebViewJavaScriptInterface{

private Context context;

public WebViewJavaScriptInterface(Context context)


{
this.context = context;
}

@JavascriptInterface
public void makeToast(String message, boolean lengthLong)
{
Toast.makeText(context, message, (lengthLong ? Toast.LENGTH_LONG :
Toast.LENGTH_SHORT)).show();
}

@JavascriptInterface

public void ClearCache()


{
simpleWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
}

/*
@JavascriptInterface
public void MyNotify(String Msg)
{

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {


CharSequence name = getString(R.string.app_name);
String description = getString(R.string.app_description);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel channel = new NotificationChannel("BUSTICKET", name,
importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager =
getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}

// Create an explicit intent for an Activity in your app


Intent intent = new Intent(context, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,
0, intent, 0);

NotificationCompat.Builder builder1 = new


NotificationCompat.Builder(MainActivity.this, "BUSTICKET")
//
.setLargeIcon(BitmapFactory.decodeResource(getBitmapFromURL("YOURURL")
.setLargeIcon(BitmapFactory.decodeResource(getResources(),

58
R.drawable.ic_launcher_foreground))
.setSmallIcon(R.drawable.ic_stat_name)

.setContentTitle("BusticketNG")
.setContentText(Msg)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(Msg))
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
// Set the intent that will fire when the user taps the notification
.setContentIntent(pendingIntent)
//.setAutoCancel(true)
;

NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(MainActivity.this);

// notificationId is a unique int for each notification that you must define
notificationManager.notify(1234, builder1.build());
}
*/

@JavascriptInterface
public void UpdateNow()
{

new AlertDialog.Builder(MainActivity.this)
.setIcon(R.mipmap.ic_launcher)
.setTitle("Update BusTicketNG")
.setMessage("Do you want to get all latest features on
BusTicketNG?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {

startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=com.busticket.busticket")));

})
.setNegativeButton("No", null)
.show();
}

/*

@JavascriptInterface
public String MYLOCATION()
{
//checkLocation();
//checkConnection();

//////////////////////////////////////////////////////////////
LocationManager locationManager;

59
String provider;
locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);

provider = locationManager.getBestProvider(new Criteria(), false);


if (ActivityCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[]
permissions,
// int[] grantResults)
// to handle the case whereshouldOverrideUrlLoading the user grants the
permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return "";
}
Location location = locationManager.getLastKnownLocation(provider);
///////////////////////////////////////////////////////////////////////////

return location.getLatitude() + ":"+ location.getLongitude();


}
*/

private class MyWebViewClient extends WebViewClient {

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if ("https://www.busticket.com.ng".contains(Uri.parse(url).getHost())) {
// This is my website, so do not override; let my WebView load the page
simpleWebView.loadUrl(url);
return true;
}
else{
// Otherwise, the link is not for a page on my site, so launch another
Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}

60
public String[] permissions = {android.Manifest.permission.MODIFY_AUDIO_SETTINGS,
android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.INTERNET};

public Boolean hasNoPermissions () {


return ContextCompat.checkSelfPermission(this,
Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this,
Manifest.permission.MODIFY_AUDIO_SETTINGS) != PackageManager.PERMISSION_GRANTED;
}

public void requestPermission () {


ActivityCompat.requestPermissions(this, permissions,1);

// ActivityCompat.requestPermissions(MainActivity.this,
// new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 99);

// ActivityCompat.requestPermissions(this, new
String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}
}

61
62

You might also like