Skip to main content

Utils

Plankton's Utils feature simplifies tasks such as displaying a Rate Us dialog in your game or sharing a piece of text.

In the following sections, you will find comprehensive guidance on implementing the Plankton Utils functionality into your Unity project.

In-App Reviews


Both Google Play and Apple's App Store provide in-app review functionality, allowing users to submit ratings and reviews without leaving your app or game.

On Android, the Google Play In-App Review lets you prompt users to submit Play Store ratings and reviews using the 1 to 5 star system, with an optional comment. Once submitted, the review is sent to the Google Play Store and will eventually be displayed.

On iOS, the Apple's Store Kit provides a similar flow, allowing users to rate your app with stars and, optionally, write a review.

tip

To understand when it's appropriate to request an in-app review, follow these guidelines.

Device requirements

In-app reviews only work on Android devices (phones and tablets) running Android 5.0 (API level 21) or higher that have the Google Play Store installed. For iOS devices the minimum iOS version is 14.0

Implementation

Remember to import the Plankton package wherever you need to use it.

using Plankton;

Here's how you can show the in-app review in your game:

Utils.ShowRateUs(succeed => Debug.Log($"Rate us popup display result:{succeed}"));

The callback of this method indicates whether in-app review flow has finished with an error or not. It does not indicate whether the user reviewed or not, or even whether the review dialog was shown. Thus, no matter the result, you should continue app flow.

Limitations
  • Android

    • To provide a great user experience, Google Play enforces a time-bound quota on how often a user can be shown the review dialog. Because of this quota, calling the Utils.ShowRateUs method more than once during a short period of time (for example, less than a month) might not always display a dialog.
  • iOS

    • If the person hasn’t rated or reviewed your app on this device, StoreKit displays the ratings and review request a maximum of three times within a 365-day period.
    • If the person has rated or reviewed your app on this device, StoreKit displays the ratings and review request if the app version is new, and if more than 365 days have passed since the person’s previous review.
note

Because this API may not present an alert, don’t call it in response to a button tap or other user action.

Share Text


This feature enables users to share a piece of text using any app on their device that supports sharing, such as messaging apps, social media platforms, or email. It is a convenient way to engage users by allowing them to share game achievements, invites, or custom messages directly from your app.

Implementation

The Utils.ShareText method allows you to easily implement sharing functionality in your game or app.

Example usage:

string textToShare = "Check out this awesome game!";
Utils.ShareText(textToShare);

When invoked, the system will display a list of apps that can handle text sharing, and the user can choose how they want to share the content.

API Refrences


Method Summaries

MethodArgumentsReturn TypeDescriptions
ShowRateUsSystem.Action<bool> callbackvoidShows an in-app review popup without leaving the game. callback gets invoked when the rating flow has finished with a boolean value indicating the success of the flow.
ShareTextstring textvoidEnables users to share a specified text via any compatible app on their device.