Implement native Android share functionality to allow users to share
images from other apps directly to TimeSafari. This mirrors the iOS
share extension functionality and provides a seamless cross-platform
experience.
Changes:
- Add ACTION_SEND and ACTION_SEND_MULTIPLE intent filters to
AndroidManifest.xml to register the app as a share target for images
- Implement share intent handling in MainActivity.java:
- Process incoming share intents in onCreate() and onNewIntent()
- Read shared image data from content URI using ContentResolver
- Convert image to Base64 encoding
- Write image data to temporary JSON file in app's internal storage
- Use getFilesDir() which maps to Capacitor's Directory.Data
- Update src/main.capacitor.ts to support Android platform:
- Extend checkAndStoreNativeSharedImage() to check for Android platform
- Use Directory.Data for Android file operations (vs Directory.Documents for iOS)
- Add Android to initial load and app state change listeners
- Ensure shared image detection works on app launch and activation
The implementation follows the same pattern as iOS:
- Native layer (MainActivity) writes shared image to temp file
- JavaScript layer polls for file existence with exponential backoff
- Image is stored in temp database and user is navigated to SharedPhotoView
This enables users to share images from Gallery, Photos, and other apps
directly to TimeSafari on Android devices.