File Sharing in Mobile App Chat

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
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 1 servicesAll 1735 services
File Sharing in Mobile App Chat
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing File Sharing in Mobile Chat

PDF, XLSX, ZIP, APK — users send everything. Task isn't reduced to "attach file" button: properly handle file picker on both platforms, correctly display file type, organize upload and secure download to recipient's device.

File Selection: Platform Pitfalls

On iOS system UIDocumentPickerViewController returns URL with security-scoped bookmark. File access opens through startAccessingSecurityScopedResource() and must close through stopAccessingSecurityScopedResource() after copying to temp directory. Forgetting the second call — security scope leak, and on next app launch file access is blocked by system.

Files from iCloud Drive don't arrive instantly: NSMetadataQuery shows download status. If file not downloaded to device — must wait for NSMetadataUbiquitousItemIsDownloadingKey completion before copying. Without this get empty 0-byte file in upload queue.

On Android — Intent(Intent.ACTION_OPEN_DOCUMENT) with addCategory(Intent.CATEGORY_OPENABLE). Uri from content provider can't directly go to network requests — must copy content through contentResolver.openInputStream() to app cache directory. Files from Google Drive and other providers don't have real filesystem path, only content:// URI.

MIME Type and Icons

Determine MIME by extension through UTType (iOS 14+) or MimeTypeMap (Android). On server — additionally check via magic bytes (first file bytes). PDF starts with %PDF, ZIP — with PK\x03\x04. Protects from renamed executables.

In chat show icon by category: document, spreadsheet, archive, audio, other. Don't try rendering preview for every type — only for PDF (through PDFKit on iOS or PdfRenderer on Android) and office formats through QuickLook / ACTION_VIEW with system app.

Upload and Download

Upload — same principles as video: chunking for files > 5 MB, background session on iOS, WorkManager on Android. Progress in bytes, not percentages — user understands 1.2 MB of 8.4 MB better than 14%.

Download on recipient's device — separate story. On iOS save file in FileManager.default.urls(for: .documentDirectory) and offer through UIActivityViewController to open in other app. Direct save to Files — through UIDocumentPickerViewController in export mode.

On Android — system DownloadManager: correctly handles background download, shows progress in notification shade, saves to Downloads. Direct path through FileOutputStream in getExternalFilesDir() — only for internal app cache, not visible to user in file manager.

Security

Whitelist of MIME types on server — mandatory. Block executable files (.exe, .apk, .ipa, .sh) or check through antivirus scan (ClamAV, VirusTotal API). Max file size — limit at API gateway level, not just on client.

Download links — presigned URL with TTL. Direct S3 links without signature mean public access to private chats.

Timeframe

Basic implementation (file picker, upload with progress, display in chat, download) — 2–3 days. Background upload + resumption + whitelist — another 1 day. Cost calculated individually.