forked from trent_larson/crowd-funder-for-time-pwa
feat: Add Android share target support for image sharing
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.
This commit is contained in:
@@ -27,6 +27,20 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="timesafari" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Share Target Intent Filter - Single Image -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Share Target Intent Filter - Multiple Images (optional, we'll handle first image) -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
|
||||
Reference in New Issue
Block a user