games_services 2.0.5 games_services: ^2.0.5 copied to clipboard
A new Flutter plugin to support game center and google play games services.
A Flutter plugin to support game center and google play games services.
Screenshot #
iOS
Android
Tutorials #
Video tutorial Will be added soon.
Apps #
Monkey Banana Android & iOS by Abedalkareem.
Nonogram Colors by @tommybuonomo.
Ripple Effect Puzzle by @tommybuonomo.
Lights: A Memory Game [Android](https://play.google.com/store/apps/details?id=us.leephillips. lights) & iOS by @theLee3.
Usage #
Sign in:
To sign in the user. You need to call the sign in before
making any action (like sending a score or unlocking an achievement).
GamesServices.signIn();
Show achievements:
To show the achievements screen.
GamesServices.showAchievements();
Show leaderboards:
To show the leaderboards screen.
GamesServices.showLeaderboards(iOSLeaderboardID: 'ios_leaderboard_id');
Note: You need to pass the leaderboard id for iOS, for android it's not required.
Submit score:
To submit a Score
to specific leader board.
-The Score
class takes three parameters:
-androidLeaderboardID
: the leader board id that you want to send the score for in case of android.
-iOSLeaderboardID
the leader board id that you want to send the score for in case of iOS.
-value
the score.
GamesServices.submitScore(score: Score(androidLeaderboardID: 'android_leaderboard_id',
iOSLeaderboardID: 'ios_leaderboard_id',
value: 5));
note: You need to pass the leaderboard id for iOS in case of iOS and the leaderboard id for android in case of android.
Unlock achievement:
To unlock an Achievement
.
The Achievement
takes three parameters:
-androidID
the achievement id for android.
-iOSID
the achievement id for iOS.
-percentComplete
the completion percent of the achievement, this parameter is optional in case of iOS.
GamesServices.unlock(achievement: Achievement(androidID: 'android_id',
iOSID: 'ios_id',
percentComplete: 100));
Note: You need to pass the achievement id for iOS in case of iOS and the achievement id for android in case of android.
the percentComplete
is required in case of iOS but not android.
Show AccessPoint (iOS Only) #
To show the access point you can call the following function:
GamesServices.showAccessPoint(AccessPointLocation.topLeading);
This feature support only on the iOS, on Android there is nothing like this supported natively.
Player id #
To get the player you can call:
final playerID = GamesServices.getPlayerID();
Installing #
Simply add the following line to your pubspec.yaml file:
dependencies:
games_services: any # <-- Add this line