PlayerStats
Stay organized with collections
Save and categorize content based on your preferences.
The PlayerStats API allows you to retrieve information about the player's activity in your
application.
Constant Summary
float |
UNSET_VALUE
|
The default value for each field when there
isn't enough data to calculate. |
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Public Method Summary
abstract float |
|
abstract float |
|
abstract int |
|
abstract float |
|
abstract int |
|
abstract int |
|
abstract float |
|
abstract float |
|
abstract float |
|
abstract float |
|
Inherited Method Summary
From interface
com.google.android.gms.common.data.Freezable
From interface android.os.Parcelable
abstract int |
describeContents
()
|
abstract void |
writeToParcel
( Parcel
arg0,
int arg1)
|
Constants
public static final float
UNSET_VALUE
The default value for each field when there isn't enough data to calculate. Please
check the value against this before using it.
Constant Value:
-1.0
Public Methods
public abstract float
getAverageSessionLength
()
The average session length of the player in minutes. Session length is determined by
the time that a player is signed in to Google Play Games services.
public abstract float
getChurnProbability
()
This method is deprecated.This field will always return UNSET_VALUE.
The approximate probability of the player not returning to play the game. Higher
values indicate that a player is less likely to return.
Returns
- A decimal number between 0 and 1 (inclusive) or
UNSET_VALUE
.
public abstract int
getDaysSinceLastPlayed
()
The approximate number of days since the player last played.
public abstract float
getHighSpenderProbability
()
This method is deprecated.This field will always return UNSET_VALUE.
The probability that the player may spend a large amount relative to other players.
Higher values indicate that a player is more likely to spend large amounts.
Returns
- A decimal number between 0 and 1 (inclusive) or
UNSET_VALUE
.
public abstract int
getNumberOfPurchases
()
The approximate number of in-app purchases for the player.
public abstract int
getNumberOfSessions
()
The approximate number of sessions of the player. Sessions are determined by the
number of times that a player signs in to Google Play Games services.
public abstract float
getSessionPercentile
()
The approximation of sessions percentile for the player. This value indicates how
many sessions the current player has played in comparison to the rest of this game's
player base. Higher numbers indicate that this player has played more sessions.
Returns
- A decimal number between 0 and 1 (inclusive) or
UNSET_VALUE
.
public abstract float
getSpendPercentile
()
The approximate spend percentile of the player. This value indicates how much the
current player has spent in comparison to the rest of this game's player base. Higher
numbers indicate that this player has spent more.
Returns
- A decimal number between 0 and 1 (inclusive) or
UNSET_VALUE
.
public abstract float
getSpendProbability
()
This method is deprecated.This field will always return UNSET_VALUE.
The approximate probability of the player choosing to spend in this game. Higher
values indicate that a player is more likely to spend.
Returns
- A decimal number between 0 and 1 (inclusive) or
UNSET_VALUE
.
public abstract float
getTotalSpendNext28Days
()
This method is deprecated.This field will always return UNSET_VALUE.
The predicted amount in USD that the player will spend over the next 28 days.
Returns
- The estimated spend total over the next 28 days in USD, or
UNSET_VALUE
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePlayerStats\u003c/code\u003e API provides insights into player activity, such as average session length, number of purchases, and days since last played.\u003c/p\u003e\n"],["\u003cp\u003eSeveral methods, including \u003ccode\u003egetChurnProbability\u003c/code\u003e, \u003ccode\u003egetHighSpenderProbability\u003c/code\u003e, \u003ccode\u003egetSpendProbability\u003c/code\u003e, and \u003ccode\u003egetTotalSpendNext28Days\u003c/code\u003e, are deprecated and will consistently return \u003ccode\u003eUNSET_VALUE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eData retrieved through the \u003ccode\u003ePlayerStats\u003c/code\u003e API may be an approximation and should be checked against \u003ccode\u003eUNSET_VALUE\u003c/code\u003e before use.\u003c/p\u003e\n"],["\u003cp\u003eSession length is determined by the duration a player is signed in to Google Play Games services, while sessions are counted by the number of sign-ins.\u003c/p\u003e\n"],["\u003cp\u003ePercentile values for sessions and spending compare a player's activity to the rest of the game's player base.\u003c/p\u003e\n"]]],["The `PlayerStats` API retrieves player activity data within an application. Key information includes `getAverageSessionLength` (in minutes), `getDaysSinceLastPlayed`, `getNumberOfPurchases`, `getNumberOfSessions`, `getSessionPercentile`, and `getSpendPercentile`. Several methods like `getChurnProbability`, `getHighSpenderProbability`, `getSpendProbability`, and `getTotalSpendNext28Days` are deprecated and return `UNSET_VALUE`. `UNSET_VALUE` indicates insufficient data for calculation. The API also handles data validity checks and parceling.\n"],null,["# PlayerStats\n\npublic interface **PlayerStats** implements [Freezable](/android/reference/com/google/android/gms/common/data/Freezable)\\\u003c[PlayerStats](/android/reference/com/google/android/gms/games/stats/PlayerStats)\\\u003e [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) \nThe PlayerStats API allows you to retrieve information about the player's activity in your\napplication. \n\n### Constant Summary\n\n|-------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n| float | [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE) | The default value for each field when there isn't enough data to calculate. |\n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Public Method Summary\n\n|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract float | [getAverageSessionLength](/android/reference/com/google/android/gms/games/stats/PlayerStats#getAverageSessionLength())() The average session length of the player in minutes. |\n| abstract float | [getChurnProbability](/android/reference/com/google/android/gms/games/stats/PlayerStats#getChurnProbability())() *This method is deprecated. This field will always return UNSET_VALUE.* |\n| abstract int | [getDaysSinceLastPlayed](/android/reference/com/google/android/gms/games/stats/PlayerStats#getDaysSinceLastPlayed())() The approximate number of days since the player last played. |\n| abstract float | [getHighSpenderProbability](/android/reference/com/google/android/gms/games/stats/PlayerStats#getHighSpenderProbability())() *This method is deprecated. This field will always return UNSET_VALUE.* |\n| abstract int | [getNumberOfPurchases](/android/reference/com/google/android/gms/games/stats/PlayerStats#getNumberOfPurchases())() The approximate number of in-app purchases for the player. |\n| abstract int | [getNumberOfSessions](/android/reference/com/google/android/gms/games/stats/PlayerStats#getNumberOfSessions())() The approximate number of sessions of the player. |\n| abstract float | [getSessionPercentile](/android/reference/com/google/android/gms/games/stats/PlayerStats#getSessionPercentile())() The approximation of sessions percentile for the player. |\n| abstract float | [getSpendPercentile](/android/reference/com/google/android/gms/games/stats/PlayerStats#getSpendPercentile())() The approximate spend percentile of the player. |\n| abstract float | [getSpendProbability](/android/reference/com/google/android/gms/games/stats/PlayerStats#getSpendProbability())() *This method is deprecated. This field will always return UNSET_VALUE.* |\n| abstract float | [getTotalSpendNext28Days](/android/reference/com/google/android/gms/games/stats/PlayerStats#getTotalSpendNext28Days())() *This method is deprecated. This field will always return UNSET_VALUE.* |\n\n### Inherited Method Summary\n\nFrom interface com.google.android.gms.common.data.Freezable \n\n|-------------------------------------------------------------------------------------------|---------------|\n| abstract [PlayerStats](/android/reference/com/google/android/gms/games/stats/PlayerStats) | freeze() |\n| abstract boolean | isDataValid() |\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |\n\nConstants\n---------\n\n#### public static final float\n**UNSET_VALUE**\n\nThe default value for each field when there isn't enough data to calculate. Please\ncheck the value against this before using it. \nConstant Value: -1.0\n\nPublic Methods\n--------------\n\n#### public abstract float **getAverageSessionLength** ()\n\nThe average session length of the player in minutes. Session length is determined by\nthe time that a player is signed in to Google Play Games services. \n\n##### Returns\n\n- A decimal number of minutes or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getChurnProbability** ()\n\n**This method is deprecated.** \n\nThis field will always return UNSET_VALUE. \nThe approximate probability of the player not returning to play the game. Higher\nvalues indicate that a player is less likely to return. \n\n##### Returns\n\n- A decimal number between 0 and 1 (inclusive) or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract int **getDaysSinceLastPlayed** ()\n\nThe approximate number of days since the player last played. \n\n##### Returns\n\n- A number of days or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getHighSpenderProbability** ()\n\n**This method is deprecated.** \n\nThis field will always return UNSET_VALUE. \nThe probability that the player may spend a large amount relative to other players.\nHigher values indicate that a player is more likely to spend large amounts. \n\n##### Returns\n\n- A decimal number between 0 and 1 (inclusive) or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract int **getNumberOfPurchases** ()\n\nThe approximate number of in-app purchases for the player. \n\n##### Returns\n\n- The count of player purchases or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract int **getNumberOfSessions** ()\n\nThe approximate number of sessions of the player. Sessions are determined by the\nnumber of times that a player signs in to Google Play Games services. \n\n##### Returns\n\n- The count of player sessions or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getSessionPercentile** ()\n\nThe approximation of sessions percentile for the player. This value indicates how\nmany sessions the current player has played in comparison to the rest of this game's\nplayer base. Higher numbers indicate that this player has played more sessions. \n\n##### Returns\n\n- A decimal number between 0 and 1 (inclusive) or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getSpendPercentile** ()\n\nThe approximate spend percentile of the player. This value indicates how much the\ncurrent player has spent in comparison to the rest of this game's player base. Higher\nnumbers indicate that this player has spent more. \n\n##### Returns\n\n- A decimal number between 0 and 1 (inclusive) or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getSpendProbability** ()\n\n**This method is deprecated.** \n\nThis field will always return UNSET_VALUE. \nThe approximate probability of the player choosing to spend in this game. Higher\nvalues indicate that a player is more likely to spend. \n\n##### Returns\n\n- A decimal number between 0 and 1 (inclusive) or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE). \n\n#### public abstract float **getTotalSpendNext28Days** ()\n\n**This method is deprecated.** \n\nThis field will always return UNSET_VALUE. \nThe predicted amount in USD that the player will spend over the next 28 days. \n\n##### Returns\n\n- The estimated spend total over the next 28 days in USD, or [UNSET_VALUE](/android/reference/com/google/android/gms/games/stats/PlayerStats#UNSET_VALUE)."]]