Co-Author: Vipul Raghuvanshi
“Kaggle is an AirBnB for Data Scientists – this is where they spend their nights and weekends. It’s a crowd-sourced platform to attract, nurture, train and challenge data scientists from all around the world to solve data science, machine learning and predictive analytics problems. … Kaggle enables data scientists and other developers to engage in running machine learning contests, write and share code, and to host datasets.” - Zeeshan-ul-hassan Usmani
Since 2016, there have been numerous requests for a Kaggle Android Application on their Product Feedback Forums, QnA Forums but not a single working demo from the Kaggle community. To build this application, what a developer needs is an API Service. In 2018, it became possible due to the release of Kaggle API.
There are lots of applications in the play store which are flashy (video streaming, gaming); people spend hours using them. Those apps take up a lot of storage space, battery time, etc., and the trade-off makes sense. But we had this notion that this application needed to be a simple and lightweight thingy. Also, a small app is also easier to manage, update, test, and optimize.
The best way was to start with an MVP, which had to be a smaller app and then build features around it over time by collecting user feedback. But it was important for us to keep the important features like listing competitions, datasets and notifying users when a new one arrives. We tried working around the intial demos which required users to create their own user tokens and had a complicated user login mechanism. This would make more than 50% users leave the application right from the login screen. Our solution to this problem was to strip down all authentication mechanisms for the start, work on just listing down important entities and the notification control mechanisms. Be patient, as there are a lot of features under development!
From the start, we wanted the application to have the look and feel of a true native-Kaggle application. So we are gonna stop right here, and let you see it for yourself!
Trust me, it wasn’t easy to implement infinite scrolling with proper pagination…
Any API serving a huge number of records, gives the data paginated and so does Kaggle. Now, because of Android Paging Library v3, it was possible to show the data properly paginated and was very smooth. We referred to many good repositories and many videos to achieve this. We made a lot of demo apps for pagination and infinite scrolling, to ensure that we would achieve the best for this app and we did it.
Since we are loading data from a layered source i.e Kaggle API as well as Room Database, we implemented RemoteMediator to merge the two sources. The container that contains the Paginated Data is called the PagingData here. In the ViewModel, we created an object of Pager and exposed the Flow<PagingData> for the UI. This flow contains a handy method which is used to cache the data and make the flow of data shareable. Because of this functionality, if there are any changes in the Flow<PagingData>, that will not be retriggered every time.
Now the PagingAdapter which is instantiated in the UI layer, is responsible to bind the PagingData to the RecyclerView. It basically takes the PagingData from ViewModel and renders it into the recycler view. This is a special Adapter, which can also have custom headers and footers. The footer we’ve used here is to show a progress indicator or an error message when API request fails.
So, this was just a gist about how we’ve implemented pagination with infinite scroll. Wasn’t that easy, but was a great learning experience.
For user engagement and notifying users we needed a mechanism which was going to allow us to send meaningful notifications to the users. Kaggle releases a lot of new features, competitions and datasets. So we went with 3 FCM topics: General, Competitions and Datasets. We built a custom Golang server which checks for new competitions and datasets at regular intervals. This server is responsible for sending notifications to the topics. When a user installs the application, their device is subscribed to all the topics and will receive notifications from all 3 categories. For controls, the user can disable certain types of notifications via our given settings.
We’re aware that there is room for improvement however, for now we’ve decided to work on Supporting Dark Theme, Filters, Search and so on. But know that, we are open for feedback and suggestions from the community!
What are you waiting for? Go install the application and don’t forget to provide your reviews on the Google Play Store!
I am becoming seriously allergic to 500-pound websites.