com.google.android.gms.games.quest.Quests |
This interface is deprecated.
The Google Play Games quests service will be deprecated as of March 2018. Do not use
the Google Play Games quests service in new apps. See the
deprecation announcement blog post for more details.
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. | |||||||||||
Display a popup based on the current state of the quest.
| |||||||||||
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.
Required API: API
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the
call. |
questId |
String : The quest ID of the quest to accept. |
Returns | |
---|---|
PendingResult<Quests.AcceptQuestResult> |
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.
Required API: API
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the
call. |
questId |
String : The parent quest ID. |
milestoneId |
String : The ID of the milestone to claim. |
Returns | |
---|---|
PendingResult<Quests.ClaimMilestoneResult> |
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.
The functionality of this activity is identical to (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
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the call. |
questId |
String : The ID of the quest to display. |
Returns | |
---|---|
Intent |
An 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.
Quests that are open will contain an "Accept" button, while quests that are completed with unclaimed milestone rewards will have a "Claim Reward" button. Buttons will not be shown for quests in other states.
If the user clicks the "Accept" button on a quest, 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
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the call. |
questSelectors |
int : 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. |
Returns | |
---|---|
Intent |
An 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
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the
call. |
questSelectors |
int : 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 |
int : The sort order to use for sorting the quests. Must be either SORT_ORDER_ENDING_SOON_FIRST or SORT_ORDER_RECENTLY_UPDATED_FIRST . |
forceReload |
boolean : 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. |
Returns | |
---|---|
PendingResult<Quests.LoadQuestsResult> |
PendingResult to access the data when
available.
|
Asynchronously load single quest data for the currently signed-in player and game.
Required API: API
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the
call. |
forceReload |
boolean : 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 |
String : The IDs of quests to retrieve. |
Returns | |
---|---|
PendingResult<Quests.LoadQuestsResult> |
PendingResult to access the data when
available.
|
Register a listener to listen for updates on Quest
instances.
Note that only one quest listener may be active at a time. Calling this method while another quest listener was previously registered will replace the original listener with the new one.
Required API: API
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the call. |
listener |
QuestUpdateListener : The listener that is called when the quest state changes.
|
Display a popup based on the current state of the quest. Popups are only displayed for quests
in STATE_ACCEPTED
. If the quest is in any other state, no popup will be
displayed. Call this from the onAccepted callbacks to show a popup for accepting a quest.
This method should generally be invoked at the point of quest acceptance (after the callback
from accept(GoogleApiClient, String)
returns).
Required API: API
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the call. |
questId |
String : 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
Required Scopes: SCOPE_GAMES
Parameters | |
---|---|
apiClient |
GoogleApiClient : The GoogleApiClient to service the call.
|