# Android Deep Link Setup for Onairos

## 🤖 Simple Android Configuration

### Step 1: Update AndroidManifest.xml

Add this configuration to your `android/app/src/main/AndroidManifest.xml` file:

```xml
<activity
    android:name=".MainActivity"
    android:exported="true"
    android:launchMode="singleTask">
    
    <!-- Existing launcher intent filter -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    
    <!-- Onairos OAuth callback intent filter -->
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="onairos" />
    </intent-filter>
</activity>
```

### Step 2: Update MainActivity (Optional)

If you have a custom MainActivity, add this to `android/app/src/main/kotlin/.../MainActivity.kt`:

```kotlin
import android.content.Intent

class MainActivity: FlutterActivity() {
    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        // Flutter will handle the deep link automatically
    }
}
```

### Step 3: Test Your Setup

**Test via ADB:**
```bash
adb shell am start -W -a android.intent.action.VIEW -d "onairos://test" com.yourpackage.name
```

**Test via Browser:**
1. Open browser on device
2. Type: `onairos://test`
3. Your app should open

## ✅ What You Need to Do

1. **Copy the XML code** above into your `android/app/src/main/AndroidManifest.xml`
2. **Make sure** `android:exported="true"` is set on your MainActivity
3. **Test the deep link** using ADB command above
4. **Use `returnLink: 'onairos'`** in your OnairosButton widget

## 🔧 Flutter Code Example

```dart
OnairosButton(
  requestData: {'basicProfile': true},
  returnLink: 'onairos', // This must match your URL scheme
  logoAssetPath: 'assets/logo.png',
  onResolved: (apiUrl, token, userData) {
    print('Success!');
  },
)
```

## ⚠️ Important Notes

- **Replace `com.yourpackage.name`** with your actual package name in the ADB test command
- **The `android:exported="true"`** is required for deep links to work
- **The `android:launchMode="singleTask"`** ensures proper deep link handling

That's it! Your Android app will now handle Onairos deep links.
