Play Review

Native API for Play 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
}
enum
Errors that can be encountered while using the 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 review flow.

Functions

ReviewManager_destroy()
void
Frees up memory allocated for the 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 Review API, making the other functions available to call.
ReviewManager_launchReviewFlow(jobject android_activity)
Asynchronously requests to display the launch 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 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_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 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 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 method 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 Review API, making the other functions available to call.

See also: ReviewManager_destroy()

Details
Parameters
jvm
The app's single JavaVM, e.g. from ANativeActivity's "vm" field.
android_context
An Android Context, e.g. from ANativeActivity's "clazz" field.
Returns
REVIEW_NO_ERROR if initialization succeeded, or an error if it failed. In case of failure the 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 launch 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 2: in some circumstances the review flow will not be shown to the user, e.g. they have already seen it recently, so do not assume that calling this method 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.