Scancart is an app that utilises the “tap-and-go” capability of Near Field Communication (NFC) in smartphones to allow elderly to obtain their groceries conveniently and monitor their nutritional intake based on their health profiles. Created for the 1D project of the 50.004 (information systems) module.
Team 4-F members:
Lim Thian Yew (1003158)
Ryan Pan Tang Kai (1005037)
Sean Soo Jun Hao (1005263)
Tao Sihan (1005515)
Lawrence Chen Qing Zhao (1005012)
Constance Chua Jie Ning (1005499)
first.cut.mp4
Our final 1D app is located under scancart/app, while the subapps folder contains smaller subapps made by team members individually as they were working on their own individual assigned app features during the earlier phases of the development process (The plan was that we would each implement our own assigned features as a standalone app, then merge everything together to create our final app).
User flow state transistion diagram of our app for reference ([] square brackets denote fragment / activity name). Each square denotes an activity, while each circle denotes a fragement within our app.
-
Our app requires access to firebase's firestore database, and authenticating access for our app to the firestore database requires that we put a google-services.json file under the root folder of our app. We've placed a google-services.json.example but the actual credentials file is not stored in the repo for security reasons. Running the app after pulling the code from the repo will require including google-services.json into the app's root folder. A working google-services.json credential file can be found in the app release. Alternatively, the app release has my own local copy scancart.zip containing all the apps and subapps in the repo with google-services.json already included.
-
The NFC tags we used to represent the shopping items are encoded in plain text format, and our NFC scanning code is thus only programmed to handle decoding tags with content in plaintext format only. To write data to the tags I used the NFC tag reader app and went to write tags > write data > Plain text to write the tag_id to the NFC tag. Example tag ids that are currently within our firestore datbase include
POTATO_23
,KITKAT_4
,NUGGETS_7
, andCOLA_1
. -
The login / registration page requires a phone number in the following format
+CCXXXXXXXX
, whereCC
is the country code (e.g. 65) andXXXXXXXX
is the phone number. Note that there is an issue with firebase's SMS authentication where running the app on a new device / android studio install will cause firebase to complain that the app is no authorized to use firebase authentication, and resolving this issue requires that we use the current android studio's gradlew to generate a SHA signature that has to be added to our firestore database in order for firebase authentication to allow the app built by your current android studio install to use SMS authentication. To bypass this, we have two testing phone numbers (+6591234567
with test OTP000000
, and+6598765432
with test OTP123456
) that can be used in the login page, which should be able bypass needing to sign the app and adding it to firestore before being able to login via SMS to access the rest of the app.
- MainActivity
Firebase Phone SMS Authentication for User Sign-In process. - FirebaseHandler
Singleton instance of FirebaseFirestore, that is used by all other classes within the app to interact with the Firebase database. Firebase calls (User Registration, Removing items from Shopping Cart, Get Completed Orders etc.) are extracted to the FirebaseHandler to facilitate modularity and readability of code in other classes. - UserAccount
Singleton instance managing the user ID that allows users to remain signed in using Shared Preference until the user choose to log out. - EditProfile
Allows user to edit their Name, Phone Number, Street Address, Postal Code, Floor and Unit Number and Health Conditions. - Shop
Near Field Communication Scanning of NFC Tags and decoding the payload into UTF-8 or UTF-16 format. Item is displayed with its nutritional information after it is successfully scanned and the payload decoded is used to query the Firebase database. Dialog Alert message is triggered if user has a health condition and scans an item that is not recommended for their health condition. - Cart
Recycler View to show all items within the shopping cart of the user. Total cost of the items in the shopping cart is calculated and shown. - ShoppingCartItemModel
Model for Shopping Cart Item with required attributes (Item Tag ID, name, quantity, cost, Image URL). This is used by the Cart and Checkout class. - ShoppingCartAdapterClass
Adapter class to manage the views in the Recycler View of Cart class. Items are sorted by alphabetical order and additional functionality such as modification of quantity and removal of item from shopping cart are included in this class. - Checkout
Confirmation of order, delivery address and delivery timeslots. Once order is checked out, the shopping cart is cleared and the order can be reviewed under the Delivery tab. - SelectTiming
Use of Android Widget DatePicker and TimePicker to select delivery date and time. - Delivery
List View to show all delivery orders, sorted by chronological order based on delivery dates. - Order
Model for Order Item with required attributes (Delivery Date, Delivery Status, Order ID). Orders are sorted by chronological order based on delivery dates. - OrderAdapter
Adapter class to manage the views in the List View of Delivery clas. - GroceryList
Recycler View to show all items within an order. - Model
Static Nest Class for Grocery Item with required attributes (Item Tag ID, name, quantity, cost, Image URL). This is used by the Grocery class. - GroceryAdapter
Adapter class to manage the views in the Recycler View of GroceryList class.