Play In-App Review

Native API for Play In-App Review.

Summary

Enumerations

ReviewErrorCode{
  REVIEW_NO_ERROR = 0,
  REVIEW_INITIALIZATION_NEEDED = -1,
  REVIEW_INITIALIZATION_FAILED = -2,
  REVIEW_REQUEST_FLOW_NEEDED = -3,
  REVIEW_REQUEST_FLOW_FAILED = -4,
  REVIEW_INVALID_REQUEST = -5,
  REVIEW_PLAY_STORE_NOT_FOUND = -6
}
enum
Errors that can be encountered while using the in-app review API.
ReviewStatus{
  REVIEW_STATUS_UNKNOWN = 0,
  REVIEW_REQUEST_FLOW_PENDING = 1,
  REVIEW_REQUEST_FLOW_COMPLETED = 2,
  REVIEW_LAUNCH_FLOW_PENDING = 3,
  REVIEW_LAUNCH_FLOW_COMPLETED = 4
}
enum
Status returned when requesting or launching the in-app review flow.

Functions

ReviewManager_destroy()
void
Frees up memory allocated for the in-app review API.
ReviewManager_getReviewStatus(ReviewStatus *out_status)
Gets the state of an ongoing asynchronous operation: requesting or launching the flow.
ReviewManager_init(JavaVM *jvm, jobject android_context)
Initialize the in-app review API, making the other functions available to call.
ReviewManager_launchReviewFlow(jobject android_activity)
Asynchronously requests to display the in-app review flow to the user.
ReviewManager_requestReviewFlow()
Asynchronously requests the information needed to launch the in-app review flow.

Enumerations

ReviewErrorCode

 ReviewErrorCode

Errors that can be encountered while using the in-app review API.

Properties
REVIEW_INITIALIZATION_FAILED

Error initializing dependencies.

REVIEW_INITIALIZATION_NEEDED

The requested operation failed: need to call ReviewManager_init() first.

REVIEW_INVALID_REQUEST

An invalid parameter was passed to the function.

REVIEW_NO_ERROR

No error has occurred.

REVIEW_PLAY_STORE_NOT_FOUND

The Play Store app is either not installed or not the official version.

REVIEW_REQUEST_FLOW_FAILED

ReviewManager_requestReviewFlow() failed.

REVIEW_REQUEST_FLOW_NEEDED

The requested operation failed: need to call ReviewManager_requestReviewFlow() first.

ReviewStatus

 ReviewStatus

Status returned when requesting or launching the in-app review flow.

Properties
REVIEW_LAUNCH_FLOW_COMPLETED

ReviewManager_launchReviewFlow() asynchronous operation has finished, and it will receive this ReviewStatus regardless of whether the user completed the review or the user dismissed the dialog.

REVIEW_LAUNCH_FLOW_PENDING

Waiting for ReviewManager_launchReviewFlow() asynchronous operation to finish.

REVIEW_REQUEST_FLOW_COMPLETED

ReviewManager_requestReviewFlow() asynchronous operation has finished.

REVIEW_REQUEST_FLOW_PENDING

Waiting for ReviewManager_requestReviewFlow() asynchronous operation to finish.

REVIEW_STATUS_UNKNOWN

Unknown Review status.

Functions

ReviewManager_destroy

void ReviewManager_destroy()

Frees up memory allocated for the in-app review API.

Does nothing if ReviewManager_init() hasn't been called.

ReviewManager_getReviewStatus

ReviewErrorCode ReviewManager_getReviewStatus(
  ReviewStatus *out_status
)

Gets the state of an ongoing asynchronous operation: requesting or launching the flow.

ReviewManager_requestReviewFlow() and ReviewManager_launchReviewFlow() execute an asynchronous operation, and this function helps to keep track of the current status of their asynchronous operation.

When using ReviewManager_requestReviewFlow(), the possible ReviewStatus values are:

  • REVIEW_REQUEST_FLOW_PENDING
  • REVIEW_REQUEST_FLOW_COMPLETED
  • REVIEW_STATUS_UNKNOWN - in case of failure

When using ReviewManager_launchReviewFlow(), the possible ReviewStatus values are:

  • REVIEW_LAUNCH_FLOW_PENDING
  • REVIEW_LAUNCH_FLOW_COMPLETED

Details
Parameters
out_status
An out parameter for receiving the review status result.
Returns
A ReviewErrorCode indicating an error associated with the most recent asynchronous operation request.

ReviewManager_init

ReviewErrorCode ReviewManager_init(
  JavaVM *jvm,
  jobject android_context
)

Initialize the in-app review API, making the other functions available to call.

See also: ReviewManager_destroy()

Details
Parameters
jvm
The app's single JavaVM, for example from ANativeActivity's "vm" field.
android_context
An Android Context, for example from ANativeActivity's "clazz" field.
Returns
REVIEW_NO_ERROR if initialization succeeded, or an error if it failed. In case of failure the in-app review API is unavailable, and there will be an error in logcat. The most common reason for failure is that the PlayCore AAR is missing or some of its classes/methods weren't retained by ProGuard.

ReviewManager_launchReviewFlow

ReviewErrorCode ReviewManager_launchReviewFlow(
  jobject android_activity
)

Asynchronously requests to display the in-app review flow to the user.

Use ReviewManager_getReviewStatus() to monitor progress and get the result.

Note: ReviewManager_requestReviewFlow() and ReviewManager_launchReviewFlow() should not be called simultaneously from multiple threads.

Note: in some circumstances the review flow will not be shown to the user, for example if they have already seen it recently. Don't assume that calling this function will always display the review dialog.

Details
Parameters
android_activity
An Android Activity object parameter, it can be obtained from ANativeActivity's "clazz" field, and it will be used for launching the review dialog as part of the Android Activity stack.
Returns
REVIEW_NO_ERROR if the request started successfully, or an error if it failed.

ReviewManager_requestReviewFlow

ReviewErrorCode ReviewManager_requestReviewFlow()

Asynchronously requests the information needed to launch the in-app review flow.

Use ReviewManager_getReviewStatus() to monitor progress and get the result.

Note: ReviewManager_requestReviewFlow() and ReviewManager_launchReviewFlow() should not be called simultaneously from multiple threads.

Details
Returns
REVIEW_NO_ERROR if the request started successfully, or an error if it failed.