GithubHelp home page GithubHelp logo

Comments (2)

MrStahlfelge avatar MrStahlfelge commented on August 17, 2024

I didn't have the need for this and the usefulness in practice is a bit limited because not all users on a platform will use a game service. So you'll need a fallback mechanism anyway, and if you have it, you can use that one in any case.

But if it is important for you, I am open and accepting PRs.

from gdx-gamesvcs.

theshoeshiner avatar theshoeshiner commented on August 17, 2024

@Trurl101

Edit: I missed the part of your comment where you already solved your issue :). Carry on 👍

One quick way around this is to extend the GpgsClient and directly access the Google Api Client:

public class CustomGpgsClient extends GpgsClient {
    public GoogleApiClient getGoogleApiClient() {
        return mGoogleApiClient;
    }
}

Then elsewhere in your code (Mine below is in the listener) you can access the Player object manually via the google api client:

@Override
public void gsOnSessionActive() {

  LOGGER.info("Player: {}",gamesClient.getPlayerDisplayName());
  LOGGER.info("serviceid: {}",gamesClient.getGameServiceId());
  
//get google player object
 Player gpgPlayer = Games.Players.getCurrentPlayer(gamesClient.getGoogleApiClient());
  
//access google specific props
  LOGGER.info("details: {}",gpgPlayer.getPlayerId());
  LOGGER.info("details: {}",gpgPlayer.getName());
  LOGGER.info("details: {}",gpgPlayer.getBannerImageLandscapeUri());
  LOGGER.info("details: {}",gpgPlayer.getBannerImagePortraitUri());
  LOGGER.info("details: {}",gpgPlayer.getIconImageUri());
}

Obviously this is specific to the google api, so you'll have to handle skipping it if youre using multiple, or coming up with your own interface for it.

from gdx-gamesvcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.