This is an example news reader app that can be used as a base for creating a standalone, native Android app for your news site or blog.
- Article viewer utilizing an RSS feed as its backend, with article contents served via a
<content:encoded>
tag. - Lightly-customized WebView intended for displaying a social feed.
- YouTube channel viewer utilizing the YouTube Data API accessed via Retrofit.
The app can be used out-of-the-box with some minimal configuration.
Show configuration items
This is the domain that your RSS feed is hosted on.
- Location: Fragments.kt line 36
Relative to the base domain specified above. Use a leading slash for the path.
- Location: Fragments.kt line 37
URL for the social feed loaded inside of a WebView. This example uses an HTML file located in the assets folder with a Twitter embed.
- Location: SocialFragment.kt line 42
This is required for the YouTube tab of the app to work.
- Location: YouTubeViewModel.kt line 44
Channel ID to fetch YouTube video data from.
- Location: YouTubeViewModel.kt line 41
Basic intent handling is supported for your site's domain by adding it to the manifest as well as a spot inside MainActivity.
Prerequisites:
- Windows / MacOS / Linux
- JDK 8
- Android SDK
- Internet connection (to download dependencies)
First, ensure that you have added a YouTube Data API key to the app, as described in the Configuration section above. Once all the prerequisites are met, make sure that the ANDROID_HOME
environment variable is set to your Android SDK directory, then run ./gradlew assembleDebug
at the base directory of the project to start the build. After the build completes, navigate to app/build/outputs/apk/debug
where you will end up with an APK file ready to install on your Android device.
This example is based off of the Android app for atU2.com, a now-defunct U2 fan site. The app was first published in March 2018 and was last updated in March 2019. Therefore, the app may not utilize the latest best practices for Android development as of this repo's publication in December 2020.
The atU2 app codebase has had minimal changes for the initial commit of this open source release:
-
Dependencies have been updated to their latest versions as of December 2020, and changes have been made to remove usage of deprecated code.
- NOTE: Kotlin Android Extensions is still being used in this project. This component is scheduled to be removed by Google in September 2021.
-
The app is stripped of its atU2 branding and now utilizes the XDA-Developers portal as an example site.
-
A proprietary web-based social component has been removed, as well as the app's YouTube API key.