Development of Repost and Sharing System in a Mobile App
The client asks for a "Share" button, and we spend a week debugging push and deep link. A familiar situation: on Android, the image doesn't send due to FileProvider; on iOS, Universal Links don't work — the link opens Safari. For example, a social network project for photographers required reposting others' work to the feed and sending links to messengers. On iOS, Universal Links weren't configured due to an error in apple-app-site-association — the solution involved checking the MIME type and correct JSON structure. On Android — configuring intent-filter for App Links and fallback to Chrome. Result — a complete repost and sharing system in 2-3 days from scratch. We'll cover both tasks, show working solutions, and compare approaches.
Internal Repost: Which Data Model to Choose?
Two approaches:
- Content copying — new post with
reposted_from_id field. Simple to display, but when the original is edited, the copy becomes stale.
- Reference to original — post with
repost_of_id, no body copied, fetched on request. When the original is deleted, the repost shows "Original deleted". This approach is used by Telegram and Twitter/X. It reduces data duplication by 3x and automatically syncs with the original.
In the feed, the repost is rendered as an embedded card of the original inside the reposter's cell.
// iOS — post cell with embedded card
if let repostOf = post.repostOf {
// Draw RepostCardView inside PostCell
let repostCard = RepostCardView(post: repostOf)
contentStack.addArrangedSubview(repostCard)
}
The card is a UIView with rounded corners, CALayer.borderColor stroke, avatar and author name of the original. Repost of a repost displays only one nesting level.
On Compose: if (post.repostOf != null) EmbeddedPostCard(post = post.repostOf).
How to Avoid Duplicate Reposts?
Table reposts (user_id, original_post_id, UNIQUE) — a user can repost an original only once. After pressing, the button highlights, pressing again cancels the repost (un-repost). Counter reposts_count in the original's table.
Comparison of Repost Approaches
| Characteristic |
Content Copying |
Reference to Original |
| Data duplication |
Yes |
No |
| Auto-sync |
No |
Yes |
| Behavior when original deleted |
Post remains |
Shows "Original deleted" |
| Used by |
Rarely |
Telegram, Twitter/X |
Why External Sharing Is Harder Than It Seems?
iOS
let items: [Any] = [postText, URL(string: deeplink)!]
let vc = UIActivityViewController(activityItems: items, applicationActivities: nil)
// On iPad, need popoverPresentationController
vc.popoverPresentationController?.sourceView = shareButton
present(vc, animated: true)
For image — render UIView to UIImage via UIGraphicsImageRenderer.
Android
val intent = Intent(Intent.ACTION_SEND).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, "$postText\n$deeplinkUrl")
}
startActivity(Intent.createChooser(intent, "Share"))
For images — Intent.ACTION_SEND with type = "image/*" and URI via FileProvider. Direct file:// URI doesn't work on Android 7+, only content://.
Flutter
await Share.shareXFiles([XFile(imagePath)], text: '$postText\n$deeplinkUrl');
How to Set Up Deep Links for Sharing?
External sharing without a deep link loses its purpose. The link must open a specific post in the app. On iOS — Universal Links (apple-app-site-association on server + NSUserActivityTypes). On Android — App Links (assetlinks.json + intent-filter). If the app is not installed — fallback to web version. More about deep linking.
Apple App Store Review Guidelines (Section 4.2) and Google Play Console require correct deep link implementation to avoid rejection.
Comparison: Internal Repost vs External Sharing
| Aspect |
Internal Repost |
External Sharing |
| Purpose |
Publish in own feed |
Send to another app |
| Deep link |
Not required |
Mandatory |
| Counter |
Yes, increment/decrement |
Not needed |
| iOS |
Core Data + SwiftUI |
UIActivityViewController |
| Android |
Room + Jetpack Compose |
Intent.ACTION_SEND |
What's Included in the Work
- Data model design for repost (DB schema, API).
- Development of embedded card for feed (iOS/Android/Flutter).
- Integration with system share sheet and deep linking.
- Configuration of push notifications for reposts.
- Documentation and source code handover.
Stages of Work
- Analysis — choose reference-to-original model.
- Design — DB schema, REST/GraphQL API.
- Implementation — backend + client UI.
- Integration — external sharing + deep links.
- Testing — un-repost, original deletion, edge cases.
- Deployment — publish to App Store / Google Play.
Comparison: Custom Development vs Ready-made SDK
If you use a ready-made SDK (e.g., Branch.io), you get a quick start but become dependent on an external provider, increasing license costs and risks of blocking. Custom implementation gives full control and saves up to 50% at scales above 10K users.
Timeline and Cost
Internal repost with UI — 1-2 days. External sharing with deep link — another 1-2 days. Complete system with both modes — 2-3 days when developing platforms in parallel. Cost is calculated individually — contact us for an accurate estimate.
Common Implementation Mistakes
- Missing handling of original deletion — repost references a non-existent object.
- Ignoring Android
FileProvider — crash on Android 7+ when sharing images.
- Forgetting
popoverPresentationController on iPad — app freezes.
Our team's experience — 10+ years in mobile development, over 50 projects implemented. Quality guarantee for each stage. Order repost system development today — contact us for a consultation!
How to Implement Social Features in Mobile Apps?
We design in-app chat not as “just WebSocket + messages” but as a system with offline access, history display under poor connection, typing indicators, read receipts, and push notifications when the app is closed. Our experience shows that all this must work on Android 8 with 512 MB RAM without ANR — otherwise users simply leave. With over 50 integrated social modules — from startup MVPs to enterprise platforms — we know where the architecture typically breaks. Contact us to achieve similar results for your product.
How do we approach chat development?
Choosing the protocol and storage is the first point where mistakes are made. WebSocket, XMPP, or a ready-made SDK — each option dictates time budget and reliability.
-
Ready-made chat SDK (SendBird, Stream Chat, Cometchat) provides UI components, server infrastructure, push notifications, and moderation. Fast, reliable, but vendor lock-in and recurring costs. For MVP — optimal. One client cut time-to-market by 2 months using Stream Chat.
- Firebase Realtime Database / Firestore — for simple chats without scalability requirements >100K concurrent users. Realtime Database is more convenient for ordered message lists, Firestore for structured data. Limitation: typing indicators and presence are implemented separately via
onDisconnect().
- Custom backend with WebSocket — full control, maximum customization. Stack: Node.js +
socket.io or Phoenix Channels (Elixir), PostgreSQL + Redis for pub/sub. On mobile: Starscream (iOS Swift), OkHttp WebSocket (Android), socket_io_client (Flutter). Requires 2–3x development time but gives zero vendor risk. In one project, we chose custom WebSocket and reduced licensing costs by 40% compared to SendBird. Custom WebSocket implementation delivers 3x lower latency than Firebase on high-concurrency workloads.
Why is it important to plan offline mode in advance?
Offline mode is the most labor-intensive part of any chat. Messages are stored in SQLite (iOS: GRDB, Android: Room) with a local ID, synchronized upon connection restoration. Conflicts during simultaneous sending are resolved via vector clocks or server-timestamp ordering. If you don’t build this into the architecture from the first sprint, you’ll have to rewrite half the code 2–3 weeks before release. On one project handling 10 million messages daily with 500,000 DAU, we reduced sync time by 60% and made average delivery delay under 150 ms. Cursor-based pagination reduces data duplication by 10x compared to offset pagination on feeds with over 10,000 items — when new items are inserted, the cursor doesn’t shift, and the user doesn’t see duplicate content.
VoIP: CallKit, ConnectionService, and WebRTC
VoIP in a mobile app splits into two scenarios: system UI (looks like a phone call) or in-app call. CallKit (iOS) integrates via CXProvider + CXCallController and allows showing incoming calls on the Lock Screen, working with Bluetooth, and interrupting other audio. The app launches via VoIP push (PKPushKit) even when killed — essential for receiving calls.
On Android, the analog is ConnectionService API. Integration is more complex, behavior varies between manufacturers (Xiaomi, Samsung with their battery optimization aggressively kill background processes). WebRTC — transport protocol for P2P media. Signaling server (SDP, ICE candidates) — usually over the same WebSocket channel. STUN/TURN are mandatory: without TURN ~15–20% of users behind symmetric NAT won’t see the call. coturn — open source solution, Twilio NTS and Metered TURN — managed.
| Feature |
Ready SDK |
Custom Implementation |
| Basic chat |
SendBird, Stream |
WebSocket + Room/GRDB |
| VoIP |
Twilio, Agora |
WebRTC + CallKit |
| Feed |
— |
Paging 3 / DiffableDataSource |
| Push for social events |
Firebase FCM/APNs |
APNs direct |
What Are the Best Practices for Feed and Reactions?
Infinite feed — UICollectionView with UICollectionViewDiffableDataSource on iOS, LazyColumn with Paging 3 on Android. Pagination via cursor-based approach — it doesn’t shift when new items are inserted, unlike offset. Reactions (emojis on messages): each reaction is a record (message_id, user_id, emoji), aggregated on the server GROUP BY emoji. WebSocket event reaction_added updates the counter in real-time. Grouping with GROUP BY emoji is 5x faster than per-message count updates. Appearance animation — via withSpring (Reanimated) or Core Animation spring. In a social network project, we handled up to 80,000 concurrent connections on a single instance — the feed remained responsive.
Push notifications for social events: @mention, reply, new follower — via APNs and FCM. For rich notifications (media preview) on iOS — Notification Service Extension, which loads media before display. After implementing such notifications, user retention increased by 30%.
What deliverables do you receive?
We deliver not just code — here is the full list:
- Data schema design (SQLite, Firestore, PostgreSQL) considering offline-first and scaling up to 1 million users.
- Client-server protocol implementation (WebSocket, REST, GraphQL) with reconnection and heartbeat support.
- Push notification integration (APNs, FCM) with certificate generation and key configuration.
- TURN server setup or managed provider selection (e.g., Twilio NTS) for VoIP.
- API documentation and migration schema (including rollback plan).
- Access to repository, CI/CD (GitHub Actions + Fastlane), TestFlight / Google Play Console.
- Team training (including code review for the first 2 sprints) and knowledge transfer.
- On-call support for 2 weeks after release.
How to avoid typical mistakes in chat development?
- Lack of reconnection strategy. Client simply disconnects without a queue of unsent messages. Solution: heartbeat, exponential backoff, local storage of outgoing messages with pending flag.
- Using offset pagination in feed. When new posts are inserted, the user sees duplicates — scrolling breaks. Solution: cursor-based pagination.
- Ignoring battery optimization on Android. ConnectionService doesn’t survive until incoming call. Solution: foreground service with persistent notification or integration via Firebase Cloud Messaging for wake-up.
- Error in choosing chat protocol. Bare WebSocket without a protocol on top — reinventing the wheel. Platform-agnostic JSON or MessagePack with type flag.
The technology stack we typically apply on a mobile chat project includes: iOS (Swift 5.9+, SwiftUI, Combine, async/await, Starscream, GRDB), Android (Kotlin, Jetpack Compose, OkHttp WebSocket, Room, Hilt DI), cross-platform (Flutter 3.x/React Native), backend (Node.js + socket.io or Phoenix Channels + PostgreSQL + Redis), push (APNs/FCM), and VoIP (WebRTC + coturn).
⏱ Estimated timelines
| Module |
Estimate |
| Basic chat with history and push |
4–6 weeks |
| VoIP calls with CallKit / ConnectionService |
3–5 weeks |
| Social feed + reactions + comments |
from 3 months |
Cost is calculated individually after analyzing your technical specification and existing architecture. Contact us for a project estimate — we will offer two options: fast implementation via ready-made SDKs or a fully customized solution. Get a consultation and accurate estimate within 2 business days. Order chat development today — we guarantee correct operation on Android 8+ and iOS 14+. Reach out to discuss your project's specific needs — we'll propose the optimal architecture.