- Google Play Console: Ensure you have created the subscription products with IDs:
automatic-ai-pro-monthlyautomatic-ai-pro-annual
- Firebase: Ensure Firebase Functions are deployed (
firebase deploy --only functions). - Test Account: Add your email as a "License Tester" in Google Play Console settings.
- Build: Install the
GooglePlayDebugbuild variant on a physical device (Emulators often have issues with Play Billing). - Navigate: Go to
SubscriptionInfoActivity(via "Automatic AI" settings). - UI Check: Verify prices are loaded (e.g., $1.99/month).
- Purchase: Click "Subscribe". The Google Play bottom sheet should appear.
- Success: Use a test card "Always approves". Verify the app shows "Active: Monthly Plan".
- Decline: Use a test card "Always declines". Verify the app shows an error.
- Logs: Monitor Logcat (
TAG: BillingManagerandFirebaseBackend). - Verify: After a successful purchase, check Logcat for "Backend verification successful".
- Firestore: Go to Firebase Console -> Firestore.
- Check
users/{userId}/subscriptions/activedocument. - Verify
isValidis true andexpiryTimeis updated.
- Check
- Uninstall & Reinstall: Uninstall the app. Reinstall it.
- Login: Log in with the same account.
- Check: Go to Subscription page.
- Action: Click "Restore Purchases".
- Result: Toast should say "Successfully restored subscription!" and status should update to Active.
- Play Console: In License Testing settings, set "Subscription duration" to "5 minutes" (effectively 5 minutes for monthly in test).
- Wait: Wait for the subscription to expire.
- Launch: Relaunch the app.
- Verify:
SubscriptionCheckWorker(or manual refresh) should eventually update status to "Expired" (inactive).
- Multi-Device: Log in on a 4th device.
- Verify: Ensure the backend handles this gracefully (currently logs warnings or rejects based on rules).
To migrate to AWS in the future:
- Create
AwsBackendServiceimplementingBackendService. - Update
SubscriptionManagerImplandBillingManagerImplto useAwsBackendServiceinstead ofFirebaseBackendService.