Learn how to create a simple Fire Tablet app and get it running in 5 minutes
This project is a sample Hello World Fire tablet app that detects Google Play Services or Amazon Appstore services and adapts its UI based on the screen orientation using Jetpack Compose. Get your app up and running in just 5 minutes! β°π±
To run this project, you will need the following:
- Android Studio
- (Optional) Fire tablet
Key features include:
- Creating a simple Hello World Fire app π
- Displaying different images based on the availability of Amazon Appstore features or Google Play Services πΌοΈ
- Use Google Jetpack Compose adaptive layout to adapt between landscape and portrait modes π
- Clone the repository:
git clone [email protected]:AmazonAppDev/hello-world-fire-tablet.git
- Open the project in Android Studio and wait for Gradle to sync. β³
- Select 'Build' > 'Make Project' to build the app. π¨
- Connect an Android emulator or a Fire tablet via USB. See instructions for π Connecting to Fire Device through ADB
- Choose 'Run' > 'Run app' to launch the app on your device or emulator.
βΆοΈ - Rotate your screen to see the adaptive layout in action! π
By using GoogleApiAvailability class, we create a new function to verify if Google Play Services are available.
private fun isGooglePlayServicesAvailable(): Boolean {
val googleApiAvailability: GoogleApiAvailability = GoogleApiAvailability.getInstance()
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(this@MainActivity)
return status == ConnectionResult.SUCCESS
}
By utilizing calculateWindowSizeClass, if it returns WindowWidthSizeClass of Expanded, we know that the device is in landscape mode and can adjust the position of the image and text accordingly:
val isExpandedScreen =
calculateWindowSizeClass(this).widthSizeClass == WindowWidthSizeClass.Expanded
If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.
If you have questions, comments, or need help with code, we're here to help:
- on Twitter at @AmazonAppDev
- on Stack Overflow at the amazon-appstore tag
Sign up to stay updated with the developer newsletter.
This project is licensed under the MIT-0 License.