:::caution
The Rate and Review API is not yet available in the Horizon Platform SDK. This sample is a placeholder that demonstrates SDK connection patterns only. The API will ship in a future SDK release.
:::
The Rate and Review sample demonstrates the architecture and connection patterns used across all Horizon Platform SDK samples, including Horizon Service initialization, MVVM state management with Jetpack Compose, and error handling. View the sample source code on GitHub.
What you will learn
Connect to the Horizon Service using HorizonServiceConnection.connect()
Structure UI state with MVVM using StateFlow and Jetpack Compose
Collect and render state changes with collectAsStateWithLifecycle()
Handle initialization errors and display them in Material 3 UI components
The project structure and build configuration shared by all Horizon Platform SDK samples
Clone or download the Horizon Platform SDK samples repository and open the rateandreview/ project in Android Studio. Configure your APPLICATION_ID in MainActivity.kt following the setup instructions provided in the code comments, then build and deploy the sample to your Quest device. For detailed build instructions, see the sample’s README.
Explore the sample
File
What it demonstrates
Key concepts
MainActivity.kt
Entry point that connects to Horizon Service, defines the RateAndReviewScreen composable
HorizonServiceConnection.connect(), collectAsStateWithLifecycle(), Material 3 components
RateAndReviewViewModel.kt
ViewModel managing UI state with StateFlow
RateAndReviewUiState data class, MutableStateFlow, coroutine-based state updates
RateAndReviewViewModelTest.kt
Unit tests for UI state data class
Testing state defaults and immutability with copy()
When you run the sample and press the Check Initialization button, the UI displays: “Rate and Review sample initialized. The Rate and Review API will be available in a future SDK release.” The loading indicator appears briefly, then the result message confirms the API is not yet implemented. No actual Rate and Review API calls occur.
Key concepts
Horizon Service connection
The sample connects to the Horizon Service in MainActivity.onCreate():
The sample wraps ViewModel operations in try-catch blocks within coroutines launched on Dispatchers.IO. Caught exceptions surface through the errorMessage property of RateAndReviewUiState, rendered in a Material 3 error container card.
Extend the sample
When the Rate and Review API becomes available, this sample will be updated. In the meantime, explore these functional sibling samples:
Users sample: Shows how to fetch and display user profiles with real API calls.
In-App Purchases sample: Demonstrates product catalog retrieval and purchase flow.
Achievements sample: Shows how to query and unlock achievements.