Quizta is an Android application that lets users answer questions to win real money. Apart from playing quizzes, there are additional features such as viewing global and quiz specific leaderboard, cricket match predictions and so on.
Boilerplate was handed over the whole project, that is, developing the landing page Website, mobile application in Android and the Admin Dashboard for the application.
For simplicity and due to budget constraints, the application was built using Java. The following paragraphs explain the application in detail.
Authentication was done using OTP service for which we used MSG91 SDKs. Handling custom login and registrations gave us the idea of using 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).
To make the user authentication part secure, we generate a hash in the back-end and push this to the application every time they log in. This hash is new for each login and allows the user to log in on only one device (eliminates multiple device logins). The hash is stored on the client end securely by performing certain hash functions and prohibiting its availability outside the application in any form. This process makes the application secure and prevents anyone from tampering with the user account under any circumstance.
With the goal of creating an effective virtual wallet, we decided to use PayTM Business (merchant) SDK for the Payment gateway, which meant that every user withdrawal had to be manually processed by the admin due to PayTM Business payouts terms (Eventually, automated payouts will be integrated into the application). The major disadvantage of this was that the winners would not be able to use the money in the wallet to play additional quizzes.
Another problem that we had to tackle was to keep the application running on the same TimeZone and time for all the users. Since we couldn’t use the time and TimeZone on the user’s device, we used the server TimeZone and converted that to IST (The customer base was restricted to India). For this purpose, we used [[Moment.js]]. The users could register and play quiz only during allocated time periods and Moment.js made this easier as it let us perform basic mathematical operations on the individual moment
he Admin could control almost all aspects 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 Cricket predictions, adding quizzes, questions, predictions, sending notifications to all users (Firebase notifications was used for this), approving Withdrawals and more.
We wrote an excel parser in NodeJS to parse an excel sheet with a set format so the admin could simply add multiple questions to the excel sheet and upload at once. Adding images to questions was a problem cleverly circumvented through the use of image URLs.
Distributing the prize money to winners of a quiz required a substantial algorithm. We coined this over several meetings with the client.
Firebase Notifications were used to send notifications to a particular Topic. The various topics we subscribed the user to were -
“QUIZTA” – For every user on the application
“PHONE_NUMBER” – The mobile number used to login/register on the application (to send notifications with regards to the user winnings, suspension and withdrawal request status)
“QUIZ_ID” – the quiz that the user registered and paid for (to send notifications with regards to the quiz leaderboard, quiz start and more).
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.