I do not have any errors when submitting my scores using:
public void submitScore(int score)
{
Games.Leaderboards.submitScore(mGoogleApiClient, "leaderboard_easy_leaderboard", score);
}
but when I run my display leaderboard code:
public void displayScores()
{
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, "leaderboard_easy_leaderboard"), 0);
}
I recieve the following errors:
11-07 17:00:39.873 32580-1830/? E/Volley: [161] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/games/v1/leaderboards/leaderboard_easy_leaderboard?language=en_US
11-07 17:00:39.882 32580-9774/? E/LeaderboardAgent: Unable to retrieve leaderboard leaderboard_easy_leaderboard
11-07 17:00:39.882 32580-9774/? E/LeaderboardAgent: No instance found for leaderboard leaderboard_easy_leaderboard for SOCIAL and ALL_TIME
The googleapis link displays the following text:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
All I needed to do was:
getString(R.string.leaderboard_easy_leaderboard)
Instead of:
"leaderboard_easy_leaderboard"
So the final solution was:
public void displayScores()
{
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, getString(R.string.leaderboard_easy_leaderboard)), 0);
}
Related
I am new to YouTube APIs. I have done create and fetch live events on YouTube. But I'm trying to start live events from my app I'm getting error:
Code:
fun startEvent(youtube: YouTube, broadcastId: String?) {
val transitionRequest = youtube.liveBroadcasts().transition(
"live", broadcastId, "status"
)
transitionRequest.key = context.getString(R.string.api_key)
transitionRequest.execute()
}
Error:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
POST https://www.googleapis.com/youtube/v3/liveBroadcasts/transition?broadcastStatus=live&id=[BROADCAST_ID]&key=[API_KEY]&part=status
{
"code": 403,
"errors": [
{
"domain": "youtube.liveBroadcast",
"message": "Invalid transition",
"reason": "invalidTransition",
"extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition#params"
}
],
"message": "Invalid transition"
}
POST
https://www.googleapis.com/androidpublisher/v2/applications/{your_package_name}/reviews/
{review_id}:reply?access_token={your_access_token}
Header : { Content-Type:application/json }
Body : { "replyText" : "comment_having_306_characters_no_html_tags" }
However, I get the following response from google
{
"error": {
"errors": [{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value"
}],
"code": 400,
"message": "Invalid Value"
}
}
According to google developer portal "The request failed because it contained an invalid value. The value could be a parameter value, a header value, or a property value."
Can anyone here enlighten me on what's wrong with the value i passed in ? Any help is appreciated.
I get the following error when trying to add new calendar under a google
account:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "Invalid resource id value.",
"reason": "invalid"
}
],
"message": "Invalid resource id value."
}
I am trying to get subscription expiry date using purchase status API (https://www.googleapis.com/androidpublisher/v1.1/applications/packageName/subscriptions/subscriptionId/purchases/token) but getting below response.May I know what is the correct way to achieve my objective?
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
Is anybody know how to do it?
Thanks in advance.
I been following Getting started and sign in to get access_token of user.
I do get an access token but when using it i am getting this error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
When I am going to apis-explorer and using they token it works just fine.
Any ideas what am I missing?
This is then URL I am trying.
https://www.googleapis.com/plus/v1/people/me?key={my_api_key}&access_token=my_access_token
These tokens have a 1 hour expiration period.