unified_game_services_google_play 0.1.0 copy "unified_game_services_google_play: ^0.1.0" to clipboard
unified_game_services_google_play: ^0.1.0 copied to clipboard

Auto-selecting Google Play Games provider for unified_game_services — native Play Games SDK on Android, REST elsewhere. Pure Dart, no Flutter.

unified_game_services_google_play #

Auto-selecting Google Play Games provider for unified_game_services. Use this and forget platform compatibility: it picks the native Play Games SDK provider on Android (native toasts/overlay, no OAuth) and the REST provider everywhere else (desktop, CLI, server). Pure Dart, no Flutter.

Wraps:

Which package do I use? #

Your app Package
Flutter app (any platform) unified_game_services_google_play_flutter — auto-resolves the Activity; no jni_flutter wiring.
Non-Flutter, multi-platform (game engine / CLI / server) — native on Android, REST elsewhere this package (unified_game_services_google_play)
Android only, non-Flutter host, want native toasts unified_game_services_google_play_android
Cloud REST tier — any platform incl. Android (NDK), no native toasts unified_game_services_google_play_rest

Building a Flutter app? Use unified_game_services_google_play_flutter instead — it wires the Android Activity resolver for you. This package needs you to supply that resolver yourself (see below), which a Flutter app should not do by hand.

Usage #

import 'package:unified_game_services_google_play/unified_game_services_google_play.dart';

// On Android: pass an activityResolver (invoked fresh before each native call).
// Elsewhere: pass an AuthStrategy.
GooglePlayGames.registerWith(
  activityResolver: () => androidActivity,         // Android only
  auth: LoopbackOAuthStrategy(clientId: '<id>'),   // desktop/CLI/server
  achievementIds: {'first_win': 'CgkI...'},
  leaderboardIds: {'global': 'CgkI...'},
);

// Same unified calls regardless of platform:
final games = UnifiedGameServices();
await games.unlockAchievement('first_win');        // native toast on Android
await games.submitScore(leaderboardId: 'global', score: 1500);

GooglePlayGames.create(...) returns the provider without registering it. GooglePlayGames.usesNative reports the current platform's choice.

Note on the selection #

On web, package:jni (FFI, no web support) is excluded from the build via a dart.library.io conditional import, so only the REST path compiles — the facade runs on web. On native, the pick is a runtime Platform.isAndroid check: jni is linked but only executes on Android. The native side carries the read-path limitation documented in unified_game_services_google_play_android (writes fire native UI; Task-result reads are pending). For full reads on Android today, also register the REST provider in the facade.

License #

MIT — see LICENSE. Independent, unofficial; not affiliated with any platform vendor. See the repository NOTICE.md.

0
likes
160
points
4
downloads

Documentation

API reference

Publisher

verified publisheraprimo.dev

Weekly Downloads

Auto-selecting Google Play Games provider for unified_game_services — native Play Games SDK on Android, REST elsewhere. Pure Dart, no Flutter.

Repository (GitHub)
View/report issues

Topics

#game-services #achievements #leaderboards #google-play-games #gamedev

License

MIT (license)

Dependencies

jni, unified_game_services_google_play_android, unified_game_services_google_play_rest, unified_game_services_platform_interface

More

Packages that depend on unified_game_services_google_play