How to Build a Robust Android Share Extension with Direct Share

Developing a Share Extension for Android (Share Sheet) The user taps Share, but your app doesn't appear in the list. Or it appears but crashes with a `SecurityException`. Sound familiar? Typical causes are an incorrect `intent-filter` or missing `ContentResolver` handling. We'll walk through buil

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
How to Build a Robust Android Share Extension with Direct Share
Medium
from 1 day to 3 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    894
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Developing a Share Extension for Android (Share Sheet)

The user taps Share, but your app doesn't appear in the list. Or it appears but crashes with a SecurityException. Sound familiar? Typical causes are an incorrect intent-filter or missing ContentResolver handling. We'll walk through building a reliable Share Extension that correctly accepts any content type — from text to video — and personalizes sharing via Direct Share.

In Android 10+, the file access model changed: you can't get the direct file path. Each content:// URI requires a temporary permission valid only during the Activity's lifecycle. Ignoring this leads to crashes on Android 11 and above. We'll show you how to avoid these errors and ensure stable content handling on all current versions.

Our solution includes proven patterns: separate intent-filters for each MIME type, safe file copying via ContentResolver, and personalized Direct Share to boost conversion. You'll receive ready-to-use code tested on Android 10–14. This saves debugging time and guarantees compatibility.

How to configure intent-filter for multiple MIME types?

The main mistake is using a single filter for everything. The Android system handles multiple <data> tags within one <intent-filter> poorly. The correct approach: create separate filters for text/plain, image/*, video/*, application/octet-stream. Example:

<intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="image/*" /> </intent-filter> 

For SEND_MULTIPLE, add analogous filters. This ensures your app appears in the Chooser for each type.

How to handle URIs without data loss?

The Uri from Intent.EXTRA_STREAM lives only during the Activity (unless persistedUriPermission is taken). Read it via ContentResolver.openInputStream() — never through File(). We copy the file to cacheDir immediately:

val inputStream = contentResolver.openInputStream(sourceUri) val destFile = File(cacheDir, "shared_${System.currentTimeMillis()}.jpg") inputStream?.use { it.copyTo(destFile.outputStream()) } 

This makes the file available even after the Activity finishes. On Android 10+, direct access to /data/ is blocked, so this pattern is mandatory.

Why does Direct Share increase conversion?

Direct Share shows personalized recipients directly in the system share sheet. According to A/B tests, conversion rates are 2–3 times higher compared to the basic Chooser. Implement it via ShortcutManagerCompat.pushDynamicShortcut() with the category SHORTCUT_CATEGORY_CONVERSATION:

val shortcut = ShortcutInfoCompat.Builder(context, "chat_anna") .setShortLabel("Anna") .setLongLived(true) .setCategories(setOf(ShortcutInfoCompat.SHORTCUT_CATEGORY_CONVERSATION)) .setIntent(Intent(context, ChatActivity::class.java).apply { putExtra("user_id", 42) }) .build() ShortcutManagerCompat.pushDynamicShortcut(context, shortcut) 

This is an additional task: you need to keep shortcuts up-to-date, update avatars, and react to contact changes. But the result is worth it.

Comparison of approaches

Characteristic Basic Share With Direct Share
Development time 2–3 weeks 4–6 weeks
Sharing conversion standard +150%
File handling online only background sync
Personalization no yes, with avatars
Integration complexity low medium

Typical problems and their solutions

Problem Solution
App doesn't appear in Chooser Check intent-filter: separate by MIME types, add SEND_MULTIPLE
SecurityException when opening URI Use ContentResolver.openInputStream() instead of File()
Data loss on screen rotation Save the copied path in onSaveInstanceState
Wrong back stack Set launchMode="singleTask" and proper taskAffinity
Checklist for testing Share Extension
  • Test single and multiple sharing of text, images, videos.
  • Test on Android 10, 12, 14 (emulator and real devices).
  • Ensure the app appears in the Chooser for all target types.
  • Check Direct Share: personalized contacts are displayed.
  • Simulate interruptions (call, rotation) before processing completes.

What is included in the work

  • Analysis of content types your app should receive.
  • Design of intent-filter and (optional) selection UI.
  • Implementation of receiver Activity with URI handling and file copying.
  • Direct Share setup with up-to-date shortcuts.
  • Testing on Android 10–14 with real files and text.
  • Documentation for integration and deployment support.
  • Time savings from ready-made solutions.

Work process

  1. Analysis — We study the content types your app should accept.
  2. Design — We choose the intent-filter scheme and design a selection UI (if needed).
  3. Development — We write the receiver Activity, handle URIs, and implement file copying.
  4. Testing — We verify on Android 10, 12, 14 with various files and text.
  5. Deployment — We publish to Google Play, configure Google Play Console for link reception.

Timeline and cost

We'll estimate your project in 1–2 days. A basic extension starts from 2 weeks. Complex integrations take up to 6 weeks. Cost is fixed after agreeing on the technical specification. We have 5+ years of Android development experience and over 20 successful Share Extensions. Get a turnkey solution with guaranteed compatibility on Android 10–14. Order your Share Extension development right now — start with a consultation.

According to the Android Developer Guide, for reliable content reception, use separate intent-filters for each MIME type.

Contact us to discuss your project and get a custom proposal.