|
| 1 | +# Android Number Verification Client |
| 2 | + |
| 3 | +This Android application serves as a client for a Node.js backend that |
| 4 | +integrates with Vonage's Number Verification API. The app demonstrates a |
| 5 | +complete flow where a user inputs their phone number, requests a login URL, and |
| 6 | +performs number verification. |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +- Uses **Compose** for a modern, declarative UI. |
| 11 | +- Interacts with a Node.js backend to generate a login URL and perform OAuth authentication. |
| 12 | +- Verifies the phone number using the **Vonage SDK**. |
| 13 | +- Displays real-time status updates and error handling. |
| 14 | +- Built with **Kotlin** and utilizes modern libraries such as **OkHttp** and **Kotlin Coroutines**. |
| 15 | + |
| 16 | +## Dependencies |
| 17 | + |
| 18 | +- [Vonage Number Verification SDK](https://github.com/Vonage/number-verification-sdk-android) to force the use of mobile data over WiFi. |
| 19 | +- **OkHttp**: For making HTTP requests. |
| 20 | +- **Kotlin Coroutines**: For asynchronous programming. |
| 21 | +- **Jetpack Compose**: For UI. |
| 22 | + |
| 23 | + |
| 24 | +## Building the App |
| 25 | + |
| 26 | +1. Open the project in **Android Studio**. |
| 27 | +2. Sync Gradle to download dependencies. |
| 28 | +3. Connect an Android device or start an emulator. |
| 29 | +4. Build and run the app by clicking the **Run** button. |
| 30 | + |
| 31 | + |
| 32 | +## Usage |
| 33 | + |
| 34 | +1. Set up the Backend |
| 35 | + |
| 36 | +Ensure the Node.js backend for this app is running. For details, see the [Node.js Backend Documentation](https://github.com/alnacle/demo-number-verification-android-node/server). |
| 37 | + |
| 38 | +2. Configure the App |
| 39 | + |
| 40 | +Update the `LOGIN_URL` in the app code with the URL where the backend is running: |
| 41 | + |
| 42 | +```kotlin |
| 43 | +const val LOGIN_URL = "https://your-node-backend-url/login" |
| 44 | +``` |
| 45 | +3. Enter a valid phone number in international format (e.g., `+1234567890`). |
| 46 | + |
| 47 | +4. Tap the **Login** button. |
| 48 | + |
| 49 | +5. The app will: |
| 50 | + - Send a request to the backend for an auth URL. |
| 51 | + - Perform OAuth and phone number verification using the Vonage SDK. |
| 52 | + |
| 53 | +6. The verification result (success or failure) will be displayed on the screen. |
| 54 | + |
| 55 | + |
| 56 | +## Troubleshooting |
| 57 | + |
| 58 | +1. **Error: HTTP 400/500 from the Backend** |
| 59 | + - Ensure the backend is running and accessible at the `LOGIN_URL`. |
| 60 | + |
| 61 | +2. **Build Issues** |
| 62 | + - Sync Gradle and ensure all dependencies are downloaded. |
| 63 | + |
| 64 | + |
0 commit comments