Skip to content

A sample Hello World Fire tablet app that detects Google Play Services or app installed from Amazon Appstore and adapts its UI based on screen orientation using Jetpack Compose. Get started in just 5 minutes! πŸ”₯πŸ“±πŸŒˆ

License

Notifications You must be signed in to change notification settings

AmazonAppDev/hello-world-fire-tablet

Android build

πŸ”₯ Hello World Fire Tablet App

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! β°πŸ“±

Prerequisites

To run this project, you will need the following:

  • Android Studio
  • (Optional) Fire tablet

βœ… Features

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 🌈

πŸ’» Building the Hello World app

  1. Clone the repository:

git clone [email protected]:AmazonAppDev/hello-world-fire-tablet.git

  1. Open the project in Android Studio and wait for Gradle to sync. ⏳
  2. Select 'Build' > 'Make Project' to build the app. πŸ”¨
  3. Connect an Android emulator or a Fire tablet via USB. See instructions for πŸ”Œ Connecting to Fire Device through ADB
  4. Choose 'Run' > 'Run app' to launch the app on your device or emulator. ▢️
  5. Rotate your screen to see the adaptive layout in action! πŸ”„

πŸ’‘ Key pointers to look at

Check Google Play Service availability

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
}

Determine device orientation

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

Get support

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:

Sign up to stay updated with the developer newsletter.

Authors

πŸ“„ License

This project is licensed under the MIT-0 License.

About

A sample Hello World Fire tablet app that detects Google Play Services or app installed from Amazon Appstore and adapts its UI based on screen orientation using Jetpack Compose. Get started in just 5 minutes! πŸ”₯πŸ“±πŸŒˆ

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages