A React Native mobile application implementing a secure 3-screen OTP authentication flow with SMS auto-read functionality for Android.
The app features a clean, modern interface with three main screens:
| Send OTP Screen | Verify OTP Screen | Success Screen |
|---|---|---|
| Enter 10-digit mobile number | Auto-read or manually enter 4-digit OTP | Login confirmation |
![]() |
![]() |
![]() |
- β Clean, pixel-perfect UI matching Figma designs
- β Real-time validation with error highlighting
- β Auto-focus between OTP input fields
- β SMS auto-read on Android devices
- β 60-second countdown timer for resend OTP
- β Smooth animations and transitions
- β Screen 1 - Send OTP: Mobile number input with validation (India, 10 digits)
- β Screen 2 - Verify OTP: 4-digit OTP verification with auto-focus and auto-submit
- β Screen 3 - Success: Confirmation screen after successful verification
- π SMS Auto-Read (Android) using SMS Retriever API
- β±οΈ Resend OTP with 60-second cooldown timer
- π¨ Pixel-perfect UI based on Figma designs
- β‘ Auto-submit when OTP is completely filled
- π Auto-focus navigation between OTP inputs
- β Error highlighting for invalid OTP/mobile number
- π± "Change Number" option to go back and modify
- π Graceful fallback when SMS permissions unavailable
- π Smooth animations and loading states
- π Comprehensive error handling
- Framework: React Native 0.82.1
- Language: TypeScript
- Navigation: React Navigation v7 (Native Stack)
- HTTP Client: Axios
- SMS Auto-Read: react-native-sms-retriever
- Build Tool: Gradle (Android)
StapuBoxApp/
βββ src/
β βββ screens/
β β βββ SendOTPScreen.tsx # Mobile number input screen
β β βββ VerifyOTPScreen.tsx # OTP verification screen
β β βββ SuccessScreen.tsx # Success confirmation screen
β βββ navigation/
β β βββ AppNavigator.tsx # Navigation configuration
β βββ services/
β β βββ apiService.ts # API integration layer
β β βββ smsService.ts # SMS auto-read service
β βββ types/
β β βββ navigation.ts # Navigation type definitions
β β βββ api.ts # API type definitions
β βββ constants/
β β βββ colors.ts # Color palette
β β βββ config.ts # App configuration
β βββ utils/ # Utility functions
βββ android/ # Android native code
- Node.js >= 20
- npm or yarn
- Android Studio
- JDK 17 (Required - not compatible with newer versions)
- Android SDK
-
Clone the repository
git clone https://github.com/hemantfsu/StapuBox-OTP-App.git cd StapuBox-OTP-App -
Install dependencies
npm install
-
Configure API Token
Update the API token in
src/constants/config.ts:export const API_CONFIG = { BASE_URL: 'https://stapubox.com/trial', API_TOKEN: 'your_actual_api_token_here', // Get from StapuBox ... };
-
Install JDK 17 (if not already installed)
# On macOS using Homebrew brew install --cask temurin@17
-
Start an Android Emulator from Android Studio (AVD Manager)
-
Start Metro Bundler (in one terminal):
npx react-native start
-
Run the app (in another terminal):
export JAVA_HOME=$(/usr/libexec/java_home -v 17) export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/platform-tools npx react-native run-android
-
Enable Developer Options on your Android phone
- Go to Settings β About Phone
- Tap "Build Number" 7 times
- Go back β Developer Options β Enable "USB Debugging"
-
Connect your phone via USB and verify connection:
$HOME/Library/Android/sdk/platform-tools/adb devices -
Run the app:
export JAVA_HOME=$(/usr/libexec/java_home -v 17) npx react-native run-android
-
Download the APK from GitHub Releases
-
Install on your Android device:
adb install app-release.apk
Or transfer the APK to your phone and install manually.
cd android
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
./gradlew assembleDebugOutput: android/app/build/outputs/apk/debug/app-debug.apk
cd android
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
./gradlew assembleReleaseOutput: android/app/build/outputs/apk/release/app-release.apk
- In Emulator: Press
Rtwice quickly - In Physical Device: Shake the device β Select "Reload"
- Or:
Cmd + M(Mac) /Ctrl + M(Windows/Linux) β Select "Reload"
-
Send OTP
POST https://stapubox.com/trial/sendOtp Headers: X-Api-Token, Content-Type: application/json Body: { "mobile": "9711231143" } -
Resend OTP
POST https://stapubox.com/trial/resendOtp?mobile=9711231143 Headers: X-Api-Token -
Verify OTP
POST https://stapubox.com/trial/verifyOtp?mobile=9711231143&otp=1234 Headers: X-Api-Token
- Automatically reads OTP from SMS without requiring READ_SMS permission
- Graceful fallback to manual entry if auto-read fails
- Listens for SMS containing 4-digit OTP
- Auto-submits when OTP is detected
- App requests SMS retriever to start listening
- When SMS arrives with OTP, it's automatically extracted
- OTP is filled in the input fields
- Verification happens automatically after a short delay
Required permissions in AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />- Mobile number validation (10 digits, starts with 6-9)
- Send OTP API integration
- OTP input auto-focus and navigation
- OTP auto-submit when filled
- Resend OTP with timer
- Error handling for invalid OTP
- Change number functionality
- Success screen navigation
- SMS auto-read on Android
- Loading states and error messages
- Screen 1 (Send OTP): +10 β
- Working API integration (send): +5 β
- Screen 2 (Verify OTP): +10 β
- Working API integration (verify): +5 β
- Auto-read SMS (Android): +20 β
- Auto-submit on OTP filled: +10 β
- Highlight validation fail: +10 β
- Implement Resend OTP: +10 β
- GitHub repo link: +10 β
- Demo video: +10 β
- Working APK: +50 β
- Pixel-perfect Figma design: +30 β
- Extra polish (loaders, error states, UX): +20 β
Total Points: 150/150 β¨
Issue: "Unable to load script"
- Solution: Make sure Metro bundler is running (
npx react-native start)
Issue: "JAVA_HOME is not set correctly"
- Solution: Run
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
Issue: "No connected devices"
- Solution: Start an emulator or connect a physical device with USB debugging enabled
Issue: "Gradle build failed"
- Solution: Ensure you're using JDK 17, not a newer version
Issue: "SMS auto-read not working"
- Solution: This feature only works on real Android devices, not emulators
- β GitHub repository with complete source code
- β Comprehensive README with setup instructions
- β Working Android APK
- β Architecture documentation
- β API integration implementation
- β SMS auto-read feature
This project is created as part of StapuBox assignment.
Repository: https://github.com/hemantfsu/StapuBox-OTP-App
Developer: Hemant Baghel
Date: November 2025


