please go through this FRS and provide a complete production level code for the android application this mentioned in this FRS. Be very strict with the code giving process. Think like a 50 year experienced designer, developer, manual tester and automation tester and then give the code. Make each and every step that you take and make the code bug free. You can use as many responses as you need for this. I will type continue in my next query and you can just continue from the point where you left off.  The FRS is:  Functional Requirement Specification (FRS)
1. Project Overview
App Name (Tentative): SpinMaster: Rewards & Fun (Optimized for App Store Search)
Target Platform: Android (Google Play Store)
Target Audience: Mass-market audience, with specific focus on regions like India, Pakistan, Bangladesh, Sri Lanka, Nepal, Bhutan.
Core Objective: Create an addictive game that offers users the chance to win rewards through daily interactions and in-app purchases, all while adhering to legal and app store policies.
2. App Features
A. Core Gameplay
Spin-based Game: Users spin a virtual wheel to win rewards, bonuses, and points. The game will have both free spins and purchasable spins.
Randomized Rewards: Use a pseudo-random generator to offer varying rewards (small amounts frequently and large amounts infrequently to keep users hooked).
Daily Challenges & Streaks: Players can participate in daily or weekly challenges that reward them for consistency. Rewards increase with each consecutive day played.
Time-Limited Offers: Periodically present users with exclusive, time-sensitive offers or events (e.g., "Unlock 2x rewards for the next hour").
B. Monetization
In-App Purchases: Users can buy more spins, premium spin boosters, or exclusive items that improve their chances to win rare rewards.
Ad Integration: Offer rewarded ads for additional spins, lives, or bonuses. Users can voluntarily watch these ads to gain advantages.
Subscription Model: Offer a VIP subscription that unlocks ad-free gaming, extra daily rewards, and exclusive bonuses.
Progression-based Unlocks: Create "tiers" in the game where users need to pay to unlock certain premium levels, items, or challenges.
C. User Retention Features
Referral System: Users are incentivized to invite friends by earning extra spins or special rewards. The more referrals they make, the greater their in-game advantages.
Dynamic Push Notifications: Based on user behavior, send personalized notifications to remind them of missed rewards, time-sensitive offers, or streak opportunities.
Leaderboard and Competitive Elements: Introduce local and global leaderboards. Players can compete for top spots and win rewards based on rank. Display top referrers to encourage viral growth.
Regular Updates & Events: Provide updates during holidays, festivals, and special occasions to keep the game content fresh and engaging. Introduce limited-time-only spins or rewards.
3. User Interface (UI) and User Experience (UX)
A. Design
Modern, Vibrant Theme: Use bold, vibrant colors to engage users. Each reward spin should be accompanied by exciting animations and celebratory sounds that deliver positive reinforcement.
Progress Bars & Visual Feedback: Users should always see how close they are to their next reward, keeping them engaged and motivating them to continue playing.
Animated Visual Effects: Incorporate particle effects, confetti, and other celebratory animations whenever a significant reward is won to heighten the sense of accomplishment.
Smooth Transitions: Ensure that all transitions between game screens, rewards, and menus are smooth and fluid to provide a high-quality feel.
B. Key Screens
Home Screen: Displays current available spins, daily challenges, current streaks, leaderboard, and access to the in-app shop.
Spin Screen: The main gameplay screen where users spin the wheel, view rewards, and see real-time winnings. It will feature a prominent spin button, with clear indicators for remaining spins.
Leaderboard Screen: Shows the user’s ranking globally and locally. Includes the top performers and allows users to challenge others for positions.
Rewards Store Screen: Allows users to redeem points for in-game items or purchase additional spins and bonuses.
Settings Screen: Allows users to manage notifications, adjust game sounds, and handle privacy settings.
4. Backend & Performance
A. Scalability
Cloud-Based Backend: The app should be built on a cloud infrastructure (e.g., AWS or Google Cloud) that can easily scale to handle millions of users. Cloud storage ensures fast access to user data, leaderboards, and spin records.
Caching for High Performance: Use caching strategies to improve performance by minimizing redundant server requests.
Database: A scalable NoSQL database (e.g., MongoDB or Firebase) to handle the massive volume of user data, including player stats, spin outcomes, purchases, and referral links.
B. Security
User Authentication: Use secure methods like Firebase Authentication or Google Sign-In to ensure user accounts are protected.
Data Encryption: Ensure all sensitive data, including user progress, is encrypted to prevent leaks and hacks.
Fraud Prevention: Implement mechanisms to detect and prevent fraudulent activities, such as fake referrals or manipulations of in-game purchases.
5. Compliance
A. App Store Compliance
Adhere strictly to Google Play Store policies regarding ad content, in-app purchases, data privacy, and user experience. Ensure the app doesn’t violate any terms that could lead to removal or flagging.
B. Data Privacy
Ensure compliance with regional privacy laws such as GDPR (for Europe), and India’s data protection laws.
Include an age verification step for compliance with COPPA (Children’s Online Privacy Protection Act) if the app targets younger audiences.
C. Legal and Ethical Compliance
Avoid any form of gambling-related functionality or monetization to avoid legal complications in countries with strict anti-gambling laws.
Ensure transparency in all ad-related activities. Users should be fully aware when they are watching an ad for in-game rewards.
6. Analytics & Reporting
A. User Tracking
User Engagement: Track daily active users, session length, and user drop-off points. Implement event tracking (Google Analytics, Firebase) to monitor user behavior and identify features that boost retention.
Conversion Tracking: Monitor how users interact with in-app purchases and ads to optimize the revenue funnel.
Referral Analytics: Analyze which users are bringing in the most referrals and adjust reward structures based on this data.
7. Monetization Strategies
A. Revenue Models
Freemium with In-App Purchases: While the base game remains free, offer attractive in-app purchases for additional spins, bonuses, and premium content.
Ad Revenue: Integrated rewarded ads with a focus on user engagement. Users voluntarily watch ads to earn extra spins and rewards.
Subscription Model: VIP users can subscribe for exclusive benefits like an ad-free experience, double daily rewards, and more spins.
8. Localization & Accessibility
A. Localization
Multiple Language Support: The app should support multiple languages relevant to the target demographic (e.g., Hindi, Urdu, Bengali). This can be done via text files that allow easy translation.
Cultural Sensitivity: Adapt the app's themes and events to reflect culturally significant moments, festivals, and seasons in South Asia.
B. Accessibility
Ensure the app is accessible for a wide range of users, including those with visual or auditory impairments. Provide features such as screen readers, high-contrast modes, and adjustable text sizes.
9. Testing & Maintenance
A. Testing
Automated Testing: Implement automated unit testing for core functions like spins, reward logic, and purchases to minimize bugs.
User Testing: Conduct beta tests with real users to identify areas of improvement, UX issues, and bugs before launch.
Load Testing: Ensure the app can handle high volumes of concurrent users without degrading performance.
B. Post-Launch Maintenance
Bug Fixes: Provide regular updates for minor bugs and glitches.
Content Updates: Add seasonal content and occasional new features to maintain user engagement.
Performance Optimization: Regular monitoring and optimization to ensure smooth gameplay, especially as the user base grows.