-
public class AegisMain Active Reach SDK interface for Android
-
-
Field Summary
Fields Modifier and Type Field Description private final EcommerceTrackerecommerceprivate final AegisUseruserprivate final PluginRegistrypluginspublic final static AegisINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitsetConsent(Map<ConsentManager.Category, Boolean> partial)Set GDPR/CCPA consent for one or more categories. final ConsentManager.ConsentPreferencesconsent()Returns the current consent preferences. final Unitinitialize(Application application, String writeKey, AegisConfig config)Initialize the Active Reach SDK final Unittrack(String eventName, Map<String, Object> properties)Track a custom event final StringlastEventId(String eventName)Phase 4 Meta Pixel companion. final Unitidentify(String userId, Map<String, Object> traits)Identify a user final Unitscreen(String screenName, Map<String, Object> properties)Track a screen view final Unitgroup(String groupId, Map<String, Object> traits)Group a user final Unitalias(String newUserId)Alias a user ID final Unitreset()Reset user identity (typically on logout) final Unitflush()Flush all queued events immediately final BootstrapResultbootstrap()Perform the /v1/sdk/bootstrap handshake against the configured control-plane. final UnitingestGovernanceHint(EventGovernanceHint hint)Ingest the event-governance hint returned from /v1/sdk/bootstrap. final StringgetAnonymousId()Get the current anonymous ID final StringgetUserId()Get the current user ID final StringgetSessionId()Get the current session ID final UnitsetDebugMode(Boolean enabled)Enable or disable debug mode final UnitsetCartData(CartData cart)Set cart data for cart recovery final CartDatagetCartData()Get current cart data final UnitclearCartData()Clear cart data (typically after purchase or cart abandonment) final UnitsubmitSpinWheel(String phone, String email, String name, Function1<Result<JSONObject>, Unit> callback)Submit spin wheel with phone/email capture final BooleantriggerExitIntent()Trigger exit intent manually (typically called when app enters background with active cart) final EcommerceTrackergetEcommerce()E-commerce helper. final AegisUsergetUser()Aegis.usernamespace (Phase 4, web 1.13 parity).final PluginRegistrygetPlugins()Phase 4.5 plugin runtime. -
-
Method Detail
-
setConsent
final Unit setConsent(Map<ConsentManager.Category, Boolean> partial)
Set GDPR/CCPA consent for one or more categories. Necessary cannot be revoked (per drift contract).
Example: Aegis.setConsent(mapOf( ConsentManager.Category.ANALYTICS to true, ConsentManager.Category.MARKETING to false, ))
-
consent
final ConsentManager.ConsentPreferences consent()
Returns the current consent preferences. Necessary always true.
-
initialize
final Unit initialize(Application application, String writeKey, AegisConfig config)
Initialize the Active Reach SDK
- Parameters:
application- Android Application instancewriteKey- Your Aegis write keyconfig- SDK configuration
-
track
final Unit track(String eventName, Map<String, Object> properties)
Track a custom event
- Parameters:
eventName- Name of the eventproperties- Optional event properties
-
lastEventId
final String lastEventId(String eventName)
Phase 4 Meta Pixel companion. Returns the messageId of the most recent
track(eventName)call (only events tracked while marketing consent was granted). Use this to pass the SAME event_id to a tenant's client-side Meta Pixel:val eventId = Aegis.lastEventId("order_completed") metaPixel.track("Purchase", payload, mapOf("eventID" to eventId))
-
identify
final Unit identify(String userId, Map<String, Object> traits)
Identify a user
- Parameters:
userId- Unique user identifiertraits- Optional user traits
-
screen
final Unit screen(String screenName, Map<String, Object> properties)
Track a screen view
- Parameters:
screenName- Name of the screenproperties- Optional screen properties
-
group
final Unit group(String groupId, Map<String, Object> traits)
Group a user
- Parameters:
groupId- Unique group identifiertraits- Optional group traits
-
alias
final Unit alias(String newUserId)
Alias a user ID
- Parameters:
newUserId- New user ID to alias
-
bootstrap
final BootstrapResult bootstrap()
Perform the /v1/sdk/bootstrap handshake against the configured control-plane. On success, returns the BootstrapResult AND applies the contained EventGovernanceHint to the NameGovernor automatically — callers don't need a separate ingestGovernanceHint call.
Throws BootstrapError on a 4xx/5xx response or unparseable body. Blocks the calling thread — invoke from a coroutine or background executor.
Parity with libs/web-sdk's
bootstrap()export. Wired by Phase 1 (PARITY.md).
-
ingestGovernanceHint
final Unit ingestGovernanceHint(EventGovernanceHint hint)
Ingest the event-governance hint returned from /v1/sdk/bootstrap.
Integrators run bootstrap() themselves (parity with web SDK) and pass the resulting hint here so the SDK can self-throttle novel event names before they hit the gateway. Passing null disables governance (Enterprise plan / outage fail-open). Safe to call before initialize() — the hint is stored and applied as soon as init completes.
-
getAnonymousId
final String getAnonymousId()
Get the current anonymous ID
-
getSessionId
final String getSessionId()
Get the current session ID
-
setDebugMode
final Unit setDebugMode(Boolean enabled)
Enable or disable debug mode
-
setCartData
final Unit setCartData(CartData cart)
Set cart data for cart recovery
- Parameters:
cart- Cart data containing items, total, and currency
-
getCartData
final CartData getCartData()
Get current cart data
-
clearCartData
final Unit clearCartData()
Clear cart data (typically after purchase or cart abandonment)
-
submitSpinWheel
final Unit submitSpinWheel(String phone, String email, String name, Function1<Result<JSONObject>, Unit> callback)
Submit spin wheel with phone/email capture
- Parameters:
phone- User's phone number (E.email- User's email address (optional)name- User's name (optional)callback- Callback with prize data or error
-
triggerExitIntent
final Boolean triggerExitIntent()
Trigger exit intent manually (typically called when app enters background with active cart)
-
getEcommerce
final EcommerceTracker getEcommerce()
E-commerce helper. Canonical 15-method tracker, parity with libs/web-sdk EcommerceTracker. Methods listed + drift-locked in libs/mobile-sdk/tests/drift/ecommerce-event-names.json.
-
getUser
final AegisUser getUser()
Aegis.usernamespace (Phase 4, web 1.13 parity). Typed PII + per-channel opt-in setters with pre-login buffering. Pinned by libs/mobile-sdk/tests/drift/user-namespace-contract.json.
-
getPlugins
final PluginRegistry getPlugins()
Phase 4.5 plugin runtime. Register Aegis-shipped plugins or your own integrations:
Aegis.plugins.register(object : PluginRegistry.Plugin { override val name = "my-plugin" override val version = "1.0.0" override fun onTrack(event: AegisEvent) = PluginRegistry.TrackDecision.Pass })
Contract pinned by libs/mobile-sdk/tests/drift/plugin-system-contract.json.
-
-
-
-