Giter VIP home page Giter VIP logo

play_game_service's Introduction

play_game_service

A Google Play Games Services plugin for flutter

Getting Started

  1. add dependencies

    dependencies:
      play_game_service: ^0.2.2
  2. import requirements

    import 'package:play_game_service/play_game_service.dart';
  3. SignIn

    // set scopeSnapShot=false if you don't want play with snapshots;
    var ret = await PlayGameService.signIn(scopeSnapShot: true);
    if(ret.success){
      if(ret.email != null){
        // you can get user's email from ret.email
      }
    }
  4. Save Game Data

    var ret = await PlayGameService.saveSnapShot("HashiTogether", new Uint8List(10), "description");
    if(ret.success){
      // save successful
    }
  5. Load Game Data

    var ret = await PlayGameService.signIn(scopeSnapShot: true);
    if (ret.success) {
      var loadResult = await PlayGameService.loadSnapShot("HashiTogether");
      if (loadResult.success) {
        Uint8List data = loadResult.data!;
        // TODO Now you have data, do what you want.
      }
    }
  6. Show Leaderboards

    PlayGameService.showLeaderboards();
  7. Submit score

    // leaderBoardId is the leaderboard's id which you added in google play console
    PlayGameService.submitScore(leaderBoardId, count);
  8. Show Achievement

    PlayGameService.showAchievements();
  9. Achievement increment

    // ACHIEVEMENT_ID is the achievement's id which you added in google play console
    PlayGameService.increment(ACHIEVEMENT_ID);

play_game_service's People

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.