# Google Play Games Services Reactivation Guide

Google Play Games Services have been implemented in the ZenTap app but are currently **disabled** via a feature flag to allow for future activation without code changes.

## Current Status

- ✅ **Implemented**: All Google Play Games functionality is fully coded
- ✅ **Configured**: Android app is properly configured with permissions and dependencies  
- ✅ **Integrated**: Game tracking and UI components are integrated
- ❌ **Disabled**: Feature flag prevents execution of Google Play Games methods

## How to Reactivate

To enable Google Play Games Services, you only need to change **one line** of code:

### Step 1: Enable the Feature Flag

In `/lib/utils/google_play_games_manager.dart`, change line 17:

```dart
// Current (disabled):
static const bool _isEnabled = false;

// Change to (enabled):
static const bool _isEnabled = true;
```

### Step 2: Configure Google Play Console

Before enabling in production, you must:

1. **Create/Update Google Play Console App**
   - Set up your app in Google Play Console
   - Configure OAuth consent screen
   - Add your app's SHA-1 fingerprint

2. **Create Achievements** (in Google Play Console):
   - `achievement_first_bubble` - First Bubble Popped
   - `achievement_100_bubbles` - 100 Bubbles Popped  
   - `achievement_1000_bubbles` - 1000 Bubbles Popped
   - `achievement_5000_bubbles` - 5000 Bubbles Popped
   - `achievement_zen_master` - Zen Master (10+ min session)
   - `achievement_speed_demon` - Speed Demon (1000 pts in 2 min)
   - `achievement_perfect_session` - Perfect Session

3. **Create Leaderboards** (in Google Play Console):
   - `leaderboard_high_score` - High Score
   - `leaderboard_zen_mode` - Zen Mode Duration
   - `leaderboard_total_bubbles` - Total Bubbles Popped
   - `leaderboard_longest_session` - Longest Session

4. **Update Configuration**:
   - Replace placeholder IDs in `google_play_games_manager.dart` with actual IDs from console
   - Update `app_id` in `/android/app/src/main/res/values/strings.xml`

### Step 3: Test and Deploy

1. Test with internal testing track in Google Play Console
2. Verify achievements and leaderboards work correctly
3. Deploy to production

## What Works When Disabled

When disabled (`_isEnabled = false`):
- ✅ App runs normally without any Google Play Games functionality
- ✅ All game mechanics work as expected  
- ✅ No crashes or errors related to Google Play Games
- ✅ UI shows "disabled" message in settings
- ✅ No network calls to Google Play Games services

## What Works When Enabled

When enabled (`_isEnabled = true`):
- ✅ User can sign in/out of Google Play Games
- ✅ Achievements unlock automatically during gameplay
- ✅ Scores submit to leaderboards after each session
- ✅ Players can view achievements and leaderboards
- ✅ Progress tracking across game sessions

## Files Involved

- `/lib/utils/google_play_games_manager.dart` - Main service class
- `/lib/ui/google_play_games_widget.dart` - UI component
- `/lib/game/zentap_game.dart` - Game integration
- `/lib/ui/settings_screen.dart` - Settings integration
- `/android/app/build.gradle.kts` - Android dependencies
- `/android/app/src/main/AndroidManifest.xml` - Android permissions
- `/android/app/src/main/res/values/strings.xml` - App configuration

## Dependencies

The app includes the required dependency:
```yaml
dependencies:
  games_services: ^4.0.2
```

No additional dependencies need to be added when reactivating.
