AppReviewService User Experience
Use the AppReviewService API
AppReviewService Example
Compatibility and Requirements
Considerations and Limitations
Previous Versions
To develop a Lightning web component with app review features, use the AppReviewService API.
In your component’s JavaScript file, import AppReviewService using the standard JavaScript import statement. Specifically, import the getAppReviewService() factory function from the lightning/mobileCapabilities module, like so:
1import { getAppReviewService } from "lightning/mobileCapabilities";After it’s imported into your component, use the factory function to get an instance of AppReviewService. With your AppReviewService instance, use the utility functions and constants to verify availability. Use the app review related functions to perform app review operations.
AppReviewService depends on physical device hardware and platform features. A component that uses AppReviewService renders without errors on a desktop computer or in a mobile browser, but app review functions fail. To avoid these errors, test if AppReviewService functionality is available before you use it.
1handleBeginClick(event) {
2 const myAppReviewService = getAppReviewService();
3 if(myAppReviewService.isAvailable()) {
4 // Perform app review related operations
5 }
6 else {
7 // AppReviewService not available
8 // Handle with message, error, beep, and so on
9 }
10}It’s straightforward to create an app review feature using AppReviewService.
requestAppReview().For example:
1myAppReviewService
2 .requestAppReview(null)
3 .then(() => {
4 // Do something with success response
5 console.log("App review request complete successfully");
6 })
7 .catch((error) => {
8 // Handle cancelation and scanning errors here
9 console.error(error);
10 });See requestAppReview() for more details about how to handle errors.
See Also