Akart is an android application for student and admin for college store management. Students can add the items to purchase to cart. Admin can verify the student and purchases by scanning the unique QR code genenrated in the student app.
myapp is the Student application and Akart_Admin is the admin android application
New users has to sign-up for new account. The users will be added to the users collection in google firebase
After the user saves the add to cart list, the item details are stored in a collection named Items
final DocumentReference documentRef = fstore.collection("Items").document(userID);
add.setOnClickListener(new View.OnClickListener() {
.
.
items.put(product_item, total);
documentRef.set(items);
.
.
}
The QR code is generated using the following code.
UserId = FirebaseAuth.getInstance().getCurrentUser().getUid();
qrgEncoder = new QRGEncoder(UserId, null, QRGContents.Type.TEXT,smallerdimension);
try{
bitmap = qrgEncoder.encodeAsBitmap();
qrcode.setImageBitmap(bitmap);
}
The Admin app scans the Qr-Code and extracts the UserID:
scan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
qrScan.initiateScan();
}
Once userID is got it searches the database for the document
qrText = result.getContents().trim();
DocumentReference documentReference = firebaseFirestore.collection("Items").document(qrText);
DocumentReference doc = firebaseFirestore.collection("Users").document(qrText);