Mobile SDK
Put SocialHub loyalty inside your own native iOS / Android app — member center, app push, Apple/Google Wallet and store-proximity. A thin native SDK wraps the server endpoints, so you ship portal changes without an app release.
The SDK ships as source (iOS Swift Package + Android Kotlin library) — clone it, compile it into your app, and debug the integration on your own devices. Build steps and full snippets are in the repo README.
What you can build
Member center in your app
Render the real member portal (points, coupons, tier) inside a native WebView with single sign-on. No second login, no re-build to ship portal changes.
App push as a send channel
Register device tokens; push joins the same automation/send stack as email.
Wallet membership card (Apple + Google)
Issue server-side from one endpoint: Apple returns a signed .pkpass that auto-updates on balance change; Google returns a save link.
Location / store-visit (LBS)
Background geofence → near-store events via the FlashLocation package (CoreLocation / Play Services, no Radar dependency).
Get the SDK & integrate
Download from https://github.com/huangchunbo2025/flash-sdk. Three packages — an iOS Swift Package and an Android Kotlin library wrapping the endpoints below. It's source you compile & debug in your app; the README has build steps and the required Xcode / Gradle setup.
FlashCoreIdentity / Bearer + device-token (push) registration.
FlashPortalWKWebView / WebView member center + SSO bridge — no native UI rebuild.
FlashLocationStore geofence monitoring (CoreLocation / Play Services) → near_store / dwell events.
iOS (Swift Package)
// 1. Add the package in Xcode: File ▸ Add Package Dependencies…
// URL: https://github.com/huangchunbo2025/flash-sdk (path: ios)
.package(url: "https://github.com/huangchunbo2025/flash-sdk", branch: "main")
// link the products you need: FlashCore, FlashPortal, FlashLocation
// 2. Configure once + set the member Bearer your backend mints:
FlashClient.shared.configure(.init(baseURL: URL(string: "https://flash.socialhub.ai")!))
FlashClient.shared.setMemberToken(memberBearerFromYourBackend)
// 3. Use it:
FlashClient.shared.registerPushToken(fcmToken) { _ in } // push
let portal = FlashPortalViewController(); portal.load(token: embedJwtFromYourBackend) // member center
FlashLocation.shared.requestAuthorization(); FlashLocation.shared.start() // LBS
// Info.plist: NSLocationAlwaysAndWhenInUseUsageDescription + NSLocationWhenInUseUsageDescriptionAndroid (Kotlin library)
// 1. Pull the android/ library (clone the repo, or publish it to your Maven).
// Transitive deps it uses: okhttp, kotlinx-coroutines, play-services-location.
// 2. Configure once + set the member Bearer your backend mints:
FlashClient.configure(FlashConfig("https://flash.socialhub.ai"))
FlashClient.setMemberToken(memberBearerFromYourBackend)
// 3. Use it:
FlashClient.registerPushToken(fcmToken) { /* result */ } // push
val portal = FlashPortalView(context); portal.load(embedJwtFromYourBackend) // member center
FlashLocation.start(context) // LBS
// Manifest declares GeofenceBroadcastReceiver; request ACCESS_FINE_LOCATION +
// ACCESS_BACKGROUND_LOCATION at runtime before FlashLocation.start().Server endpoints the SDK calls
The packages wrap these — you can also call them directly. The member center reuses the same per-client embed JWT you sign for the web Member Portal Embed; the native flow opens it in a WebView instead of an iframe. Full member-center contract: Member Portal Embed.
Member center via WebView SSO
GET https://flash.socialhub.ai/embed/member/native?token=<JWT>
// Flash verifies the JWT, sets an HttpOnly first-party cookie, renders the portal.
// A native WebView is first-party to its own origin, so the cookie survives in-app navigation.Register a push device token
POST /api/consumer/push/register // teamId + memberId come from the session, never the body
{ "platform": "ios", "provider": "fcm", "token": "<FCM token>", "appBundleId": "com.yourbrand.app" }
// → { "ok": true } (idempotent UPSERT)Issue a Wallet card (Apple / Google)
POST /api/consumer/wallet/issue { "platform": "apple" } // "apple" | "google"
// Apple → 200 application/vnd.apple.pkpass (auto-updates on points/tier change — no app code)
// Google → 200 { "saveUrl": "…" }Store-proximity (near-store) events
// 1. Nearest ≤20 store geofences for the device to monitor (lat/lng used transiently, never stored):
POST /api/v2/lbs/nearby-stores { "lat": 40.71, "lng": -74.00, "limit": 20 }
// 2. Report an on-device transition → near_store / store_dwell triggers:
POST /api/v2/lbs/geofence-event { "storeId": "…", "eventType": "enter" } // or "dwell"
// server gates consent + GPC (fail-closed); no consent/GPC present → { recorded: false }Configure your Apple Pass Type ID / APNs / FCM credentials with your SocialHub team before going live — Wallet + push require those to be set.
Integrating the SDK?
Talk to an engineer about the native integration, Wallet/push credentials, or store-proximity setup.
Talk to engineering