Quizta is an Android application developed in Java which lets users answers some questions to win real money. Apart from playing quizzes to win money, there are additional features such as viewing Cricket Match Predictions, global leaderboard and quiz specific leaderboard.
Boilerplate was handed over the whole project i.e developing the landing page Website, mobile application in Android and the Admin Dashboard for the application.
The Tricky part of the application was to figure out the wallet feature for this application. Initially, the client tried to strike a deal with Razorpay for the wallet feature in the application but for some business specific reasons, that deal fell through and we decided to look for other options. We finally decided to create a virtual wallet in the application and using PayTM Business ( Merchant ) SDK for the Payment gateway in the application – which meant that there was no real wallet in the application and every user withdrawal had to manually processed by the Admin since PayTM Business payouts required some additional information and terms from the client which wasn’t available to the client at the moment ( Eventually automated payouts will be integrated to the application ). The major disadvantage of the virtual wallet using PayTM business account was that the user would receive the amount withdrawn to his PayTM account and the users could not use the money in the wallet to play additional quizzes. They only could withdraw the money.
The application was initially going to be build in Flutter but the client at this moment didn’t require the application for the iOS platform and wasn’t looking for a great design. Because of the budget constraints and the tight schedule, we decided to proceed with Java for the application. Authentication on the application was done using OTP service for which we used MSG91 SDKs. Handling custom login and registrations gave us the idea to use custom response codes in the REST APIs for various statuses ( It’ll be clearer as to why we used custom response codes in the further paragraphs ).
We’ll take a break in regards to the Mobile Application and move over to the Admin Dashboard for the application. The Admin could control pretty much every aspect of the application from the provided Dashboard ( as requested by the client ) some of the features included banning a user, shutting down the application ( which then prompts a message on the Android side to let users know that the Application is down for maintenance ), Turn OFF/ON predictions ( making it not possible/possible for the users to view Cricket Predictions ), adding quizzes, adding questions, adding predictions, sending notifications to all users ( Firebase Notifications was used for this ), approving Withdrawals and more.
Making the Admin add each question individually was not feasible for the client, hence we wrote an excel parser in NodeJS to parse an excel sheet with a set format to upload how many ever questions the admin pleased to. This excel parser came in pretty handy as the user just had to add all their questions to the excel sheet and then upload it. Each question could also have an Image which became tricky if we were parsing the excel sheet, hence, we finally decided to stick to image URLs which made both our and the client’s life easier.
Distributing the amount to various users after a quiz was over was what required some attention as we had to figure out a formula for this. We finally coined a formula which distributed the winnings among the user in a fair way. This was done over several meetings with the client.
Another problem that we had to tackle was to keep the application running on the same TimeZone and time for all the users. Obviously, we couldn’t use the time and TimeZone on the user’s device. The client only requiring this application to be used by Indian users ( with PayTM coming into the picture ) made it easier as we used the server TimeZone and converted that to IST and synced all users on that TimeZone. For this purpose, we used Moment.js. There was a registration time duration and quiz time duration ( which meant that the users could only register for the quiz between a set period of time and the same was applicable for the user playing the quiz ) , Moment.js made this easier as it let us perform basic mathematical operations on the each individual moment.
Firebase Notifications were used to send notifications to a particular Topic. The various topics we subscribed the user to where “QUIZTA” – For every user on the application, “PHONE_NUMBER” – The mobile number used by the user to login/register on the application ( to send notifications in regards to the user winnings, user suspension and withdrawal request status ), “QUIZ_ID” – the quiz the user registered and paid for ( to send notifications in regards to the quiz leaderboard being generated, quiz start and more ).
To make the user authentication part secure, we generate a hash in the back-end and push to this to the application every-time he logs in, this hash is new for each login which allows the user to login on only one device ( eliminates multiple device log ins ). This hash is stored on the client end securely by performing a certain hash function and not making available outside the application in any form. This process makes the application secure and doesn’t let anyone tamper with the user account in any shape or form.
We briefly thought about using Cloud Pub/Sub ( publish-subscribe ), but eventually settled for Rest APIs as the application could be managed with polling the API every x amount of time and only managing the quiz gameplay in realtime.
The application is live and can be used by users to play various quizzes. You can download it from here