Android Platform Support
Android Platform Support
Section titled “Android Platform Support”Android-specific implementation details for Toss.
Android 10+ Clipboard Restrictions
Section titled “Android 10+ Clipboard Restrictions”Android 10 (API 29) and later restrict background clipboard access. Apps can only access clipboard when:
- App is in foreground
- App has a foreground service running
Implementation Status
Section titled “Implementation Status”Basic Structure: Created android_foreground_service.dart with:
- Foreground service management
- Notification handling
- Android version detection
- Clipboard restriction workarounds
Files:
flutter_app/lib/src/core/services/android_foreground_service.dartflutter_app/android/app/src/main/AndroidManifest.xml(needs updates)
Required Native Code
Section titled “Required Native Code”1. Foreground Service
Section titled “1. Foreground Service”Create android/app/src/main/kotlin/.../ClipboardService.kt:
- Extend
Serviceclass - Implement
startForeground()with notification - Monitor clipboard changes
- Handle service lifecycle
2. Service Notification
Section titled “2. Service Notification”- Persistent notification (required for foreground service)
- Show sync status
- Allow user to stop service
3. Manifest Permissions
Section titled “3. Manifest Permissions”Update AndroidManifest.xml:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /><uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<service android:name=".ClipboardService" android:enabled="true" android:exported="false" android:foregroundServiceType="dataSync"> <intent-filter> <action android:name="com.toss.CLIPBOARD_SERVICE" /> </intent-filter></service>Next Steps
Section titled “Next Steps”- Create
ClipboardService.ktin Android project - Update
AndroidManifest.xmlwith permissions and service declaration - Implement notification channel
- Test on Android 10+ device
See Also
Section titled “See Also”- iOS and Android Implementation Guide - Detailed implementation guide
- Platform Overview - Return to platform overview