# Publishing TaxiDrive on Google Play

Work through the steps in order. Everything in the app and in this folder is
ready; these steps need your accounts, keys or server.

## 1. Upload key (one time)

Google Play only accepts a bundle signed with your **upload key**. TaxiDrive
doesn't have one configured yet. Pick one of these:

- **Reuse the key you use for your other apps** (`/Users/ali/cred/android.keystore`).
  One upload key for several apps is allowed.
- **Or make a new one:**
  ```bash
  keytool -genkeypair -v -keystore /Users/ali/cred/taxidrive-upload.jks \
    -alias taxidrive -keyalg RSA -keysize 2048 -validity 10000
  ```
  Back it up somewhere safe. If you lose it, Play support has to reset it.

Then add the key to `~/.gradle/gradle.properties`, never to the project:

```properties
TAXIDRIVE_STORE_FILE=/Users/ali/cred/taxidrive-upload.jks
TAXIDRIVE_STORE_PASSWORD=...
TAXIDRIVE_KEY_ALIAS=taxidrive
TAXIDRIVE_KEY_PASSWORD=...
```

## 2. Build the bundle

```bash
cd android/taxidrive
./gradlew :app:bundleRelease
# → app/build/outputs/bundle/release/app-release.aab
```

For each new upload, raise `versionCode` (and `versionName`) in
`app/build.gradle.kts`.

## 3. Google sign-in for the store build (Google Cloud Console)

Each signing key needs its own **Android** OAuth client (package
`net.softhem.taxidrive`) in the same project as the Web client. Without it,
Google sign-in fails with error 28444.

- [x] Debug key: `6F:F0:30:2B:B1:DB:0A:4D:1F:D7:E0:5F:11:8E:7D:A3:07:AD:F2:A4`
- [ ] Upload key: get the SHA-1 with
  `keytool -list -v -keystore <your upload keystore>`
- [ ] Play app-signing key: after the first upload, copy it from Play Console →
  **Test and release → App integrity → App signing**
- [ ] **OAuth consent screen → Publish app.** While it's "Testing", only
  listed test users can sign in.

## 4. taxidrive.net (Drupal)

- [ ] **Deploy** the module change `taxidrive_user_delete()` (push, then
  `./deploy.sh`). It deletes a user's quiz attempts and daily counts along
  with the account.
- [ ] **Privacy page:** add a Basic page with URL alias `/privacy` and the
  content of `privacy/privacy.html`. Use the Full HTML text format so the
  `id="delete-account"` anchor survives. The app links to
  https://taxidrive.net/privacy.
- [ ] **Terms page:** add a Basic page with URL alias `/terms` and the content
  of `terms/terms.html`. Play Console → App content → **App-level trader
  status and Terms of Service**: choose **Yes, my trader status applies to
  this app** and enter https://taxidrive.net/terms.
- [ ] **Account deletion** (the app's "Delete my account" opens
  `/user/{uid}/cancel`):
  - People → Permissions: give **Authenticated user** the "Cancel own user
    account" permission.
  - Configuration → People → Account settings → "When cancelling a user
    account": choose **Delete the account and its content**.
  - Check the site can send email, because Drupal confirms self-deletion by
    email.
- [ ] **Reviewer test account:** create a user such as `playreview` with a
  password and the `paid_user` role, so reviewers aren't stopped by the daily
  limit.

## 5. Play Console: create the app

- App name: **TaxiDrive: Taxi Theory Test**. Default language: English (United
  States) or English (United Kingdom). Type: App. Free.
- **Store listing:** text from `store_listing.md`, plus `icon_512.png`,
  `feature_graphic.png` and `screenshots/`.

## 6. Play Console: App content (Policy → App content)

- [ ] **Privacy policy:** https://taxidrive.net/privacy
- [ ] **App access:** "Some functionality is restricted". Give the reviewer
  account from step 4 with this instruction: "Open Account, sign in with
  this username and password. Practice and Exam then start from the Practice
  tab." Also say that guest mode works without signing in.
- [ ] **Ads:** No, the app contains no ads.
- [ ] **Content rating:** fill in the questionnaire with category
  *Reference, News or Educational*. Answer No to violence, sexual content,
  profanity, drugs and gambling. Users don't interact with each other, and
  no location is shared. The expected rating is "Everyone" / PEGI 3.
- [ ] **Target audience:** 18 and over (people training for a professional
  licence). The app is not designed for children.
- [ ] **Data safety:** answers in `data_safety.md`
- [ ] **Data deletion URL:** https://taxidrive.net/privacy#delete-account
- [ ] **Government apps:** No. **Financial features:** None. **Health:** No.
- [ ] **News app:** No.

## 7. Testing track, then production

A personal developer account created after November 2023 must run a **closed
test with at least 12 testers opted in for 14 days in a row** before it can
apply for production. AllianceStudent's `googleplay/production_access.md`
describes how that went last time, and its questionnaire answers make a good
template.

1. Test and release → **Closed testing** → create a track, add testers (a
   Google Group or an email list), upload `app-release.aab`, and roll out.
2. After 14 days with at least 12 opted-in testers, apply via **Dashboard →
   Apply for production**.
3. Then use **Production** → create a release with the same bundle.

## 8. Payments note

The app does not sell anything and does not link to the website's packages,
because Google Play requires Play Billing for digital content bought in an
app. Paid access bought on the website still works when that user signs in
to the app. Selling inside the app would need Play Billing plus a server step
that grants the package role.
