By Sam Clark
Just The News is a region-based news application built using Kotlin, Firebase, and NewsAPI.
The API Key for NewsAPI is not included in the GitHub repository.
If attempting to use the application, please get your own free key on the website and create a file "apikeys.properties" and store it with the name "NEWS_API_KEY"
- Project Aims
- Approach
- Technologies
- Project Planning
- Implementation
- Key Learnings
- Achievements
- Challenges
- Conclusions
- Credits
- Develop an Android-based news application using Kotlin
- Design an application with a greater focus on UI/UX design than prior Kotlin projects
- Implement an account system using Firebase and Firestore
- Utilise NewsAPI to populate the application with data
- Include functionality to retrieve regional news based on the user's location with permission
- Allow the user to define the region that their account is set to manually, with appropriate news retrieved
- Implement the functionality for the user to log in using their Google account
- User should be able to search for news based on their input
- Functionality for the user to save articles on their account
- The user should have the ability to delete their account along with any saved data related to it permanently
- Application should behave as expected when changing between vertical and horizontal orientation and data should be correctly retained
Prior to beginning development of the project, I defined the key aims that I was looking to achieve with the application which have been mentioned in the prior section. The core fundamental design goals of the application were to design a Kotlin Android app with an account system that was based around Firebase integration with a greater focus on the UI/UX design.
After I had decided on these core goals, I proceeded to determine the theme of the application and decided upon a news application using the NewsAPI service for retrieving the data. Once this aspect had been determined, I performed some research to decide on how I wanted to approach the project.
This involved:
- Research into the NewsAPI service and the type of functionality that it offered, as well as what limitations there may be to consider with it
- It was also necessary to research similar applications to determine a general idea for the UI/UX of the application, as such I particularly focused on the Sky News and BBC News applications as a reference point.
- I also needed to look into the functionality of Firebase to determine how I would approach the account system as it was my first time using it
This diagram was created to determine the overall flow of the application in terms of how the user navigates between activities.

Some storyboards of the intended user interface for the application were created, representing some of the core activities in the application.
During development, I eventually opted to not include Apple login but this was initially considered during the planning phase.


During the course of developing the application, there were some opportunities to utilise functionality that I had not used before in a Kotlin application. One example of this was requesting the user's location and using that location as a basis for the news that is being retrieved.
Below shows an example snippet of how this was implemented in the appliaction. The countryCodeChecker function is used to determine if the current location is supported by the NewsAPI service.
private fun getLastLocation() {
if (ActivityCompat.checkSelfPermission( // Re-check location permission
this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(
this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED
) {
fusedLocationClient.lastLocation
.addOnSuccessListener { location: Location? ->
if (location != null) {
val geocoder = Geocoder(this, Locale.getDefault())
val addresses =
geocoder.getFromLocation(location.latitude, location.longitude, 1) // Get address based on lat/lon of location
if (!addresses.isNullOrEmpty()) {
val country = addresses[0].countryName // Get the country name string from what geocoder provided
// Converts from country name to country code for supported regions, if region is unsupported then defaults to US
// For example, "United Kingdom" would return "gb" or China would return "cn"
countryCode = countryCodeChecker.checkCountryCode(country)
loadTopStories() // Load top stories based on the region retrieved
} else {
Log.d(TAG, "No address found for the provided coordinates.")
loadTopStories() // Load with default (US) data if no region found
}
} else {
Log.d(TAG, "Location is null")
loadTopStories() // Load with default (US) data if no region found
}
}
.addOnFailureListener { e ->
Log.e(TAG, "Error getting location: ${e.message}", e)
loadTopStories() // Load with default (US) data if no region found
}
}
}
Below shows screenshots of the final implementation of the application, including several of the activities in the application and some examples of mentioned functionality. Any user details in the applications were used for testing and are not associated with any actual person.
Application was developed using a Pixel 7 Pro API 34 Emulator
- Gained much more understanding of how to implement effective UI/UX design in an Android application, this included the use of things such as DrawerLayout, RecyclerViews and properly populating the application with data using adapters.
- Learnt how to utilise Firebase and Firestore in a Kotlin application for authentication and the storing/retrieval of user data.
- Improved general knowledge of both the Kotlin language and utilising APIs in an application.
- Was able to implement functionality for Google Login and tie that to Firebase effectively.
- Utilised the functionality to use the user's location data as a basis for data retrieval, using Geocoder and requesting the permission for the user's coarse and fine location information. Whilst ensuring that the application had other methods for setting location, either a default location (US) if permission is not allowed or allowing the user to set their own region for their account.
- I feel I was able to effectively design an application with a good user interface that was more involved than my prior experience with Kotlin.
- Met my overall planning & design goals in terms of features & functionality and ensured that my final application met the overall design of the storyboards.
- Maintained a consistent design across the entire application that makes it easy to use and navigate.
- Utilising the location functionality and allowing the user to set their own region and reflecting that appropriately with the news retrieved.
- I was able to use Firebase and Firestore in an effective manner and the application works smoothly in authenticating the user, storing their details and retrieving those details when needed.
There were some key challenges with the application, particularly in relation to ensuring that the UI/UX design met my intended goals based on the project storyboards. Getting the DrawerLayout with the Side Navigation Bar to work took some time to figure out but I was satisfied with the end result.
There are some aspects of the application that could be improved, particularly when it comes to cases where the news article may not have an associated image, or sometimes there can be unexpected behaviour when it comes to data being displayed in certain languages (Japanese, Korean & Chinese for example) where the news article activity can have some unintended formatting.
I believe I was able to effectively meet my design goals with the application, implementing a much more robust android application that includes a consistent design across the entire application with several features that were an interesting challenge to implement due to the use of new functionality that I have not interacted with before (Location permissions, Google/Apple Login, RecyclerViews/Adapters & DrawerLayouts).
Changing the news retrieved based on the location was a particularly interesting feature to implement that allowed me to experiment with several approaches, as such the use of the NewsAPI was very beneficial in allowing me to come up with functionality that I may have not initially thought of when I was laying out the goals for the application; but after looking at the functionality that the API provided it became a key aspect that I wanted to include.
There are definitely some aspects that I could improve; such as some of the minor formatting issues of news articles in certain languages. Overall however, I feel the application allowed me to challenge myself to implement new types of functionality and create an application that was more involved than prior projects.
Credit to NewsAPI for the use of the news data in the application.
Credit for the Icons used in the application belongs to Icons8