public class AppReview
- Object
- AppReview
Entry point for requesting an app store review and collecting feedback.
AppReview prefers the platform’s native review prompt
(SKStoreReviewController on iOS, the Play In-App Review API on Android)
and transparently falls back to a Codename One drawn rating widget on the
simulator, desktop, the web target and platforms/OS versions without a
native prompt.
There are two ways to use it:
Manual – call
requestReviewat a moment that makes sense in your app (e.g. right after the user completed a meaningful task). You decide the timing entirely.Scheduled – configure the engagement heuristics once and call
registerSessionon every app start.AppReviewkeeps a small amount of state inPreferences(launch count, install date, last prompt time) and only prompts once the thresholds are met and the user has not already rated or opted out.
The fallback widget routes high ratings to the store and low ratings to a
private feedback channel so unhappy users are heard before they post a one
star public review (see setHighRatingThreshold and
setFeedbackListener).
AppReview.getInstance()
.setStoreUrl(storeUrl) // the listing for THIS platform's store
.setSupportEmail("support@example.com")
.registerSession();
Methods
public static AppReview getInstance() | The shared AppReview instance. |
public AppReview setMinimumLaunches(int minimumLaunches) | The number of app launches that must accumulate before the scheduler in registerSession will prompt for a review. |
public AppReview setMinimumDaysInstalled(int minimumDaysInstalled) | The number of days that must elapse after the first recorded launch before the scheduler will prompt for a review. |
public AppReview setDaysBetweenPrompts(int daysBetweenPrompts) | The minimum number of days between two consecutive review prompts shown by the scheduler. |
public AppReview setHighRatingThreshold(int highRatingThreshold) | The lowest star value (1-5) that is still considered a positive rating in the fallback widget. |
public AppReview setStoreUrl(String storeUrl) | The store URL opened by the fallback widget for a positive rating (and used when no native prompt is available). |
public AppReview setSupportEmail(String supportEmail) | The support e-mail address used by the fallback widget to collect feedback for low ratings when no FeedbackListener handled it. |
public AppReview setFeedbackListener(FeedbackListener feedbackListener) | Registers a listener that intercepts the outcome of the fallback rating widget so feedback can be delivered through your own channel. |
public void registerSession() | Records the current app session and, when the configured engagement thresholds are satisfied and the user has not already rated or opted out, prompts for a review. |
public boolean shouldPrompt() | Whether registerSession would prompt for a review given the current persisted state and configuration. |
public void requestReview() | Immediately asks the user for a review. |
public void markCompleted() | Permanently stops the scheduler from prompting again (the user rated the app or chose “don’t ask again”). |
public void reset() | Clears all persisted engagement state (launch count, install date, last prompt time and the completed flag) so the engagement cycle starts over. |
Inherited methods
Method details
getInstance
public static AppReview getInstance()AppReview instance.Returns
setMinimumLaunches
public AppReview setMinimumLaunches(int minimumLaunches)registerSession will prompt for a review. Defaults to 5.Returns
setMinimumDaysInstalled
public AppReview setMinimumDaysInstalled(int minimumDaysInstalled)Returns
setDaysBetweenPrompts
public AppReview setDaysBetweenPrompts(int daysBetweenPrompts)Returns
setHighRatingThreshold
public AppReview setHighRatingThreshold(int highRatingThreshold)Returns
setStoreUrl
public AppReview setStoreUrl(String storeUrl)Returns
setSupportEmail
public AppReview setSupportEmail(String supportEmail)FeedbackListener handled it. When
null and no listener is set, the feedback step is skipped.Returns
setFeedbackListener
public AppReview setFeedbackListener(FeedbackListener feedbackListener)Returns
registerSession
public void registerSession()start lifecycle method). It is cheap and safe to call every launch.shouldPrompt
public boolean shouldPrompt()registerSession would prompt for a review given the current
persisted state and configuration. Exposed mainly for testing and for
apps that want to drive the prompt from their own trigger.Returns
requestReview
public void requestReview()registerSession this ignores the scheduling thresholds, but it
still respects the “already completed” opt out and records the prompt
time so the scheduler will not pile on.markCompleted
public void markCompleted()reset
public void reset()