com.google.android.gms.games.quest.Quests |
Entry point for Quest functionality.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Quests.AcceptQuestResult | Result delivered when accepting a quest. | ||||||||||
Quests.ClaimMilestoneResult | Result delivered when claiming a milestone. | ||||||||||
Quests.LoadQuestsResult | Result delivered when quest data has been loaded. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SELECT_ALL_QUESTS | Array of all the valid state selector constants. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Asynchronously accept the quest.
| |||||||||||
Asynchronously claim the milestone.
| |||||||||||
Get an intent to view a single quest.
| |||||||||||
Get an intent to view a list of quests.
| |||||||||||
Asynchronously load the quest data for the currently signed-in player and game into
a single result, including only quests in the provided state array.
| |||||||||||
Asynchronously load single quest data for the currently signed-in player and game.
| |||||||||||
Register a listener to listen for updates on
Quest instances.
| |||||||||||
Show the default popup for certain quest states.
| |||||||||||
Unregisters this client's quest update listener, if any.
|
Constant used to add quests in the STATE_ACCEPTED
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Constant used to add quests in the STATE_COMPLETED
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Constant used to add quests in the STATE_COMPLETED
state that have at least
one milestone in the STATE_COMPLETED_NOT_CLAIMED
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
. This is a subset of
SELECT_COMPLETED
, so the two criteria do not both need to be included to get
all quests.
Constant used to add quests in the STATE_ACCEPTED
state that have been marked
as ending soon isEndingSoon()
returned by load(GoogleApiClient, int[], int, boolean)
and
getQuestsIntent(GoogleApiClient, int[])
. This is a subset of STATE_ACCEPTED
, so the two
criteria do not both need to be included to get all quests.
Constant used to add quests in the STATE_EXPIRED
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Constant used to add quests in the STATE_FAILED
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Constant used to add quests in the STATE_OPEN
state to the QuestBuffer returned
by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Constant used to add quests in the STATE_FAILED
state with a
getLastUpdatedTimestamp()
no older than 7 days ago. In simple terms, it will
include quests that the player attempted, but failed in the last 7 days. Use with the
load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
API endpoints. This is a subset of
STATE_FAILED
.
Constant used to add quests in the STATE_UPCOMING
state to the QuestBuffer
returned by load(GoogleApiClient, int[], int, boolean)
and getQuestsIntent(GoogleApiClient, int[])
.
Sort requests with the quests ending soon first.
Sort requests with the recently updated quests first.
Array of all the valid state selector constants.
Asynchronously accept the quest. This enters the player into an STATE_OPEN
quest and will start tracking their progress towards the milestone goal.
API
SCOPE_GAMES
apiClient | The GoogleApiClient to
service the call. |
---|---|
questId | The quest ID of the quest to accept. |
PendingResult
to access the data
when available.
Asynchronously claim the milestone. This method informs Google Play Games services that the
player has completed the milestone on this device, and prevents the milestone from being
claimed on another device by the same user. If the method call returns
STATUS_OK
, your app should reward the player based on the
CompletionRewardData of the milestone.
API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the
call. |
---|---|
questId | The parent quest ID. |
milestoneId | The ID of the milestone to claim. |
PendingResult
to access the data when
available.
Get an intent to view a single quest. Note that this must be invoked using
startActivityForResult(Intent, int)
so that the identity of the
calling package can be established.
(GoogleApiClient, int[])
, the only difference being this activity displays a single quest
rather than a list of quests. See
getQuestsIntent(GoogleApiClient, int[])
for usage details and behavior.
Required API: API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
questId | The ID of the quest to display. |
Intent
that can be started to view the quest.
Get an intent to view a list of quests. Note that this must be invoked using
startActivityForResult(Intent, int)
so that the identity of the
calling package can be established.
accept(GoogleApiClient, String)
will be called. If the quest is successfully
accepted, the activity will close with RESULT_OK
, and the data
intent will contain a parcelable object in EXTRA_QUEST
indicating the accepted
quest.
If the user clicks the "Claim Reward" button on a quest, the activity will close with
RESULT_OK
, and the data intent will contain a parcelable object in
EXTRA_QUEST
indicating the quest the user would like to claim a reward for.
The caller is responsible for examining the state of this returned quest. If the quest state
is STATE_COMPLETED
, the caller should invoke
claim(GoogleApiClient, String, String)
. If the claim succeeds, the caller
should then give the reward to the player.
If the user canceled, the result will be RESULT_CANCELED
.
Required API: API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
questSelectors | Array of quest selectors to include in the list of quests. Valid values
include: SELECT_UPCOMING , SELECT_OPEN , SELECT_ACCEPTED ,
SELECT_ENDING_SOON , SELECT_COMPLETED ,
SELECT_COMPLETED_UNCLAIMED , SELECT_EXPIRED ,
SELECT_FAILED , or SELECT_RECENTLY_FAILED .
Use SELECT_ALL_QUESTS to view all quests. |
Intent
that can be started to view the list of quests.
Asynchronously load the quest data for the currently signed-in player and game into a single result, including only quests in the provided state array.
Required API:API
SCOPE_GAMES
apiClient | The GoogleApiClient to
service the call. |
---|---|
questSelectors | An array of quest selectors to indicate which quest states to include.
Valid values include:
SELECT_UPCOMING , SELECT_OPEN ,
SELECT_ACCEPTED , SELECT_ENDING_SOON ,
SELECT_COMPLETED , SELECT_COMPLETED_UNCLAIMED ,
SELECT_EXPIRED , SELECT_FAILED , or SELECT_RECENTLY_FAILED .
Use SELECT_ALL_QUESTS to view all quests. |
sortOrder | The sort order to use for sorting the quests. Must be either
SORT_ORDER_ENDING_SOON_FIRST or SORT_ORDER_RECENTLY_UPDATED_FIRST . |
forceReload | If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching. |
PendingResult
to access the data
when available.
Asynchronously load single quest data for the currently signed-in player and game.
Required API:API
SCOPE_GAMES
apiClient | The GoogleApiClient to
service the call. |
---|---|
forceReload | If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching. |
questIds | The IDs of quests to retrieve. |
PendingResult
to access the data
when available.
Register a listener to listen for updates on Quest
instances.
API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
listener | The listener that is called when the quest state changes. |
Show the default popup for certain quest states. Call this from the onAccepted and onComplete
callbacks. We currently only support popups for quest in either the
STATE_ACCEPTED
or STATE_COMPLETED
state. If the quest is in
another state, no popup will be shown. Display a popup based on the current state of the
quest. Popups are only displayed for quests in STATE_ACCEPTED
or
STATE_COMPLETED
. If the quest is in any other state, no popup will be
displayed.
accept(GoogleApiClient, String)
returns) or when a quest is newly completed (after receiving
onQuestCompleted(Quest)
.
Required API: API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
questId | The ID of the quest to fetch assets from for the popup (name and images). |
Unregisters this client's quest update listener, if any.
Required API:API
SCOPE_GAMES
apiClient | The GoogleApiClient to service the call.
|
---|