### start Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Starts the Apphud SDK. This method must be called before any other Apphud methods. ```APIDOC ## start ### Description Starts the Apphud SDK. This method must be called before any other Apphud methods. ### Method void ### Parameters - **context** (android.content.Context) - The application context. - **apiKey** (java.lang.String) - Your Apphud API key. - **storeRedirect** (java.lang.String) - Optional: The store redirect URL. - **observerMode** (boolean) - Whether to run in observer mode. - **callback** (kotlin.jvm.functions.Function1) - A callback function to be executed after initialization. ### Response None explicitly defined in the provided source. ``` -------------------------------- ### SplitCompat Installation and Management Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Methods for installing SplitCompat and managing internal sets of split configurations. ```java public static boolean installActivity(android.content.Context) static synthetic bridge java.util.Set zzb(com.google.android.play.core.splitcompat.SplitCompat) private final java.util.Set zzf() ``` ```java final synchronized boolean zzb(android.content.Context,java.util.Set) ``` ```java public final java.util.Set zza() ``` -------------------------------- ### Start Connection Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Starts the connection to the BillingClient. ```APIDOC ## Start Connection ### Description Establishes a connection to the Google Play Billing service. A listener is required to handle connection state changes. ### Method `startConnection(com.android.billingclient.api.BillingClientStateListener)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **listener** (com.android.billingclient.api.BillingClientStateListener) - Required - Listener to be notified of connection state changes. ``` -------------------------------- ### DeferredComponentChannel Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Handles deferred component installation status. ```APIDOC ## DeferredComponentChannel API ### Description Provides methods to report the success or failure of deferred component installations. ### Methods - `completeInstallError(java.lang.String, java.lang.String)`: Reports an installation error. - `completeInstallSuccess(java.lang.String)`: Reports a successful installation. ### Constants - `TAG` (java.lang.String): Tag for logging. ``` -------------------------------- ### Apphud.start Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Initializes the Apphud SDK during app launch. This is the primary method for starting the SDK and requires your Apphud API key. ```APIDOC ## Apphud.start ### Description Initializes the Apphud SDK during app launch. This is the primary method for starting the SDK and requires your Apphud API key. ### Method `static Future start({required String apiKey, String? userID, bool? observerMode, String? baseUrl})` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Parameters * **apiKey** (String) - Required - Your Apphud API key from the dashboard. * **userID** (String?) - Optional - Your own unique user identifier. If null, UUID is auto-generated. * **observerMode** (bool?) - Optional - iOS only. Sets SDK to Observer (Analytics) mode. Pass `true` if you purchase via other code, `false` if using `Apphud.purchase()`. * **baseUrl** (String?) - Optional - Custom base URL for API requests. Contact Apphud support for custom URLs. ### Request Example ```dart void initializeApphud() async { final user = await Apphud.start( apiKey: 'your-api-key', userID: 'user@example.com', observerMode: false, ); print('User ID: ${user.userId}'); print('Has purchases: ${user.hasPurchases}'); } ``` ### Response #### Success Response * **ApphudUser** - User object after initialization completes. #### Response Example ```json { "userId": "user-id-from-sdk", "hasPurchases": true } ``` ``` -------------------------------- ### start() - Standard Mode Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/configuration.md Initializes the Apphud SDK in standard mode, which is the default. In this mode, the SDK automatically manages all purchase events and sends receipts to Apphud. ```APIDOC ## start() - Standard Mode (Default) ### Description Initializes the Apphud SDK in standard mode. The SDK automatically handles purchase events and receipt submission to Apphud. ### Method `start({ required String apiKey, String? userID, bool observerMode = false, String? baseUrl, })` ### Parameters #### Parameters - **apiKey** (String) - Required - Your Apphud API key. - **userID** (String) - Optional - The unique identifier for the user. - **observerMode** (bool) - Optional - Default: `false`. Set to `true` for observer mode (iOS only). - **baseUrl** (String) - Optional - Custom API base URL. Use `setHost()` for this. ### Example ```dart await Apphud.start( apiKey: 'sk_live_your_key_here', userID: 'user@example.com', observerMode: false, // Default ); ``` ``` -------------------------------- ### SplitInstallSessionState Management Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Methods for creating and querying the state of a split installation session. ```java public static com.google.android.play.core.splitinstall.SplitInstallSessionState create(int,int,int,long,long,java.util.List,java.util.List) public boolean hasTerminalStatus() public java.util.List languages() public java.util.List moduleNames() ``` -------------------------------- ### Initialize Apphud SDK Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Starts the Apphud SDK with your API key and a unique user identifier. This is the first step to enable Apphud's features. ```APIDOC ## Initialize Apphud SDK ### Description Starts the Apphud SDK with your API key and a unique user identifier. This is the first step to enable Apphud's features. ### Method `Apphud.start` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **apiKey** (string) - Required - Your Apphud API key. - **userID** (string) - Required - A unique identifier for the current user. ### Request Example ```dart await Apphud.start(apiKey: 'your-key', userID: 'user@example.com'); ``` ### Response None (This is an initialization method). ``` -------------------------------- ### Apphud Initialization Flow Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Illustrates the sequence of events from starting the Apphud SDK to receiving callbacks for products, user data, and placements. ```mermaid graph TD A[Apphud.start() or startManually()] B[SDK connects to Apphud backend] C[User object returned] D[apphudDidFecthProducts() callback (products fetched)] E[userDidLoad() callback (user initialized)] F[placementsDidFullyLoad() callback (placements ready)] A --> B --> C --> D --> E --> F ``` -------------------------------- ### Initialization Handler Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Handles the initialization of the Apphud SDK, including starting manually or updating user IDs. ```APIDOC ## Initialization Handler ### Description Provides methods for initializing the Apphud SDK, such as starting the SDK manually or updating the user identifier. ### Methods - `startManually` - `start` - `updateUserID` ### Parameters #### `startManually` Parameters - `apiKey` (String) - Required - Your Apphud API key. - `userId` (String) - Optional - The unique identifier for the user. #### `start` Parameters - `apiKey` (String) - Required - Your Apphud API key. #### `updateUserID` Parameters - `userId` (String) - Required - The new unique identifier for the user. ### Request Example (startManually) ```json { "apiKey": "your_api_key", "userId": "user_123" } ``` ### Response (Success) - `success` (Boolean) - Indicates if the operation was successful. ``` -------------------------------- ### start() - Observer Mode (iOS) Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/configuration.md Initializes the Apphud SDK in observer mode, specifically for iOS. Use this mode when your application handles purchases through other means (e.g., StoreKit2, another SDK) and you only require Apphud for analytics. ```APIDOC ## start() - Observer Mode (iOS) ### Description Initializes the Apphud SDK in observer mode on iOS. This mode is intended for scenarios where your app manages purchases independently, and Apphud is used solely for analytics. ### Method `start({ required String apiKey, String? userID, bool observerMode = false, String? baseUrl, })` ### Parameters #### Parameters - **apiKey** (String) - Required - Your Apphud API key. - **userID** (String) - Optional - The unique identifier for the user. - **observerMode** (bool) - Required - Set to `true` to enable observer mode. - **baseUrl** (String) - Optional - Custom API base URL. Use `setHost()` for this. ### When to use: - Your app uses StoreKit2 or SKPaymentQueue directly. - Another SDK handles purchases. - You want Apphud for analytics only. ### Example ```dart await Apphud.start( apiKey: 'sk_live_your_key_here', observerMode: true, ); ``` ``` -------------------------------- ### Initialize Apphud SDK with start Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Initializes the Apphud SDK during app launch. Use this for standard initialization. The userID is optional and will be auto-generated if not provided. observerMode is for iOS only. ```dart static Future start({ required String apiKey, String? userID, bool? observerMode, String? baseUrl, }) ``` ```dart void initializeApphud() async { final user = await Apphud.start( apiKey: 'your-api-key', userID: 'user@example.com', observerMode: false, ); print('User ID: ${user.userId}'); print('Has purchases: ${user.hasPurchases}'); } ``` -------------------------------- ### Attribution Setup Workflow Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/NAVIGATION.md This workflow covers different methods for setting up user attribution with the Apphud SDK, including direct attribution, web attribution, and search ads attribution. This is crucial for marketing analytics. ```plaintext 1. Apphud.setAttribution(...) [Main API/Attribution] or Apphud.attributeFromWeb(...) [Main API/Attribution] or Apphud.collectSearchAdsAttribution() [Main API/Attribution] ``` -------------------------------- ### Initialize Apphud SDK Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Start the Apphud SDK with your API key and a user ID. Retrieve the user ID after initialization. ```dart await Apphud.start(apiKey: 'your-key', userID: 'user@example.com'); final user = await Apphud.userID(); ``` -------------------------------- ### Handle Paywall Loading Timeouts Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/errors.md Implement logic to handle paywall loading timeouts gracefully. This example sets a maximum timeout and provides a user-friendly error message if the loading takes too long, suggesting a retry or fallback. ```dart final result = await Apphud.showPaywall( paywall, maxTimeout: 5.0, // 5 seconds ); if (!result.success && result.error?.message?.contains('timeout') == true) { // Paywall loading took too long showError('Loading took too long. Please try again.'); // Could show cached/fallback paywall } ``` -------------------------------- ### Complete Apphud Listener Implementation Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-listener.md A comprehensive example demonstrating how to implement the ApphudListener interface in Flutter. This includes handling user ID changes, product fetching, user loading, subscription updates, non-renewing purchases, placements, and Android-specific purchases. ```dart import 'package:apphud/apphud.dart'; class MyApphudListener implements ApphudListener { @override Future apphudDidChangeUserID(String userId) async { print('User ID: $userId'); } @override Future apphudDidFecthProducts(List products) async { print('Products loaded: ${products.length}'); } @override Future userDidLoad(ApphudUser user) async { print('User: ${user.userId}'); print('Has purchases: ${user.hasPurchases}'); if (user.experimentName != null) { print('Experiment: ${user.experimentName} - ${user.variationName}'); } } @override Future apphudSubscriptionsUpdated( List subscriptions, ) async { final active = subscriptions.where((s) => s.isActive); print('Active subscriptions: ${active.length}'); } @override Future apphudNonRenewingPurchasesUpdated( List purchases, ) async { print('Purchases: ${purchases.length}'); } @override Future placementsDidFullyLoad(List placements) async { print('Placements ready: ${placements.length}'); } @override Future apphudDidReceivePurchase(AndroidPurchaseWrapper purchase) async { print('Android purchase: ${purchase.productId}'); } } void main() async { // Set listener before or after initialization await Apphud.setListener(listener: MyApphudListener()); // Initialize SDK await Apphud.start(apiKey: 'your-api-key'); } ``` -------------------------------- ### Get Raw Placements Immediately Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Returns placements immediately without awaiting Store products to load. Product data may be incomplete. Use `placements()` or `fetchPlacements()` for loaded products. ```dart void quickCheckPlacements() async { final placements = await Apphud.rawPlacements(); // Products might not be loaded yet final placement = placements.firstWhereOrNull( (p) => p.identifier == 'main_paywall', ); } ``` -------------------------------- ### Apphud.start Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/seeds.txt Initializes the Apphud SDK with the necessary context and configuration. ```APIDOC ## Apphud.start ### Description Initializes the Apphud SDK. This method should be called during application startup. ### Parameters #### Request Body - **context** (android.content.Context) - Required - The application context. - **apiKey** (java.lang.String) - Required - The Apphud API key. - **userID** (java.lang.String) - Optional - The user identifier. - **observerMode** (boolean) - Required - Whether to run in observer mode. - **callback** (kotlin.jvm.functions.Function1) - Optional - Callback function for initialization status. ``` -------------------------------- ### Get Error Resolution Intent Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Retrieves an Intent that can be used to start an activity for resolving Google Play services errors. ```APIDOC ## getErrorResolutionIntent ### Description Returns an Intent that can be used to start an activity to resolve Google Play services errors. ### Method `getErrorResolutionIntent(android.content.Context context, int errorCode, java.lang.String intentSender)` ### Parameters - **context** (android.content.Context) - Required - The context of the application. - **errorCode** (int) - Required - The error code returned by Google Play services. - **intentSender** (java.lang.String) - Required - A string representing the sender of the intent. ### Return Value - `android.content.Intent` - An Intent to resolve the error, or null if no resolution is available. ``` -------------------------------- ### Initialize, Check Premium, Show Paywall Workflow Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/NAVIGATION.md This workflow outlines the sequence of calls for initializing the SDK, checking premium access, fetching placements, and displaying a paywall if the user is not premium. It covers core SDK initialization and subscription status checks. ```plaintext 1. Apphud.start() [Configuration/Initialization] 2. Apphud.hasPremiumAccess() [Main API/Subscription Query] 3. if !premium: Apphud.placements() [Main API/Placements] 4. Apphud.showPaywall(paywall) [Main API/Paywalls] ``` -------------------------------- ### Get Error Resolution Pending Intent Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Retrieves a PendingIntent that can be used to start an activity for resolving Google Play services errors. ```APIDOC ## getErrorResolutionPendingIntent ### Description Returns a PendingIntent that can be used to start an activity to resolve Google Play services errors. ### Methods - `getErrorResolutionPendingIntent(android.content.Context context, int errorCode, int requestCode)` - `getErrorResolutionPendingIntent(android.content.Context context, int errorCode, int requestCode, java.lang.String playServicesPackageName)` ### Parameters #### Method 1: `getErrorResolutionPendingIntent(android.content.Context context, int errorCode, int requestCode)` - **context** (android.content.Context) - Required - The context of the application. - **errorCode** (int) - Required - The error code returned by Google Play services. - **requestCode** (int) - Required - The request code for the PendingIntent. #### Method 2: `getErrorResolutionPendingIntent(android.content.Context context, int errorCode, int requestCode, java.lang.String playServicesPackageName)` - **context** (android.content.Context) - Required - The context of the application. - **errorCode** (int) - Required - The error code returned by Google Play services. - **requestCode** (int) - Required - The request code for the PendingIntent. - **playServicesPackageName** (java.lang.String) - Required - The package name of Google Play services. ### Return Value - `android.app.PendingIntent` - A PendingIntent to resolve the error, or null if no resolution is available. ``` -------------------------------- ### Get Product Details Programmatically Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Retrieve details for a specific in-app product by its ID. This example shows how to access the iOS price if the product wrapper is available. ```dart final product = await Apphud.product('product_id'); if (product?.skProductWrapper != null) { print('iOS price: ${product!.skProductWrapper!.price}'); } ``` -------------------------------- ### GoogleApi Initialization Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Demonstrates different ways to initialize a GoogleApi instance with various constructors. ```APIDOC ## GoogleApi Initialization ### Description Provides constructors for initializing `GoogleApi` instances. ### Constructors - **GoogleApi(Activity activity, Api api, ApiOptions apiOptions, Settings settings)**: Initializes with Activity, Api, ApiOptions, and Settings. - **GoogleApi(Activity activity, Api api, ApiOptions apiOptions, StatusExceptionMapper mapper)**: Initializes with Activity, Api, ApiOptions, and StatusExceptionMapper. - **GoogleApi(Context context, Api api, ApiOptions apiOptions, Looper looper, StatusExceptionMapper mapper)**: Initializes with Context, Api, ApiOptions, Looper, and StatusExceptionMapper. - **GoogleApi(Context context, Api api, ApiOptions apiOptions, StatusExceptionMapper mapper)**: Initializes with Context, Api, ApiOptions, and StatusExceptionMapper. ``` -------------------------------- ### Deferred Component Manager Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt APIs for managing deferred components, including installation, uninstallation, and checking install states. ```APIDOC ## Deferred Component Manager ### Description Provides functionality to manage deferred components, allowing for dynamic installation and uninstallation of features. ### Class `io.flutter.embedding.engine.deferredcomponents.DeferredComponentManager` ### Methods - `destroy()`: Destroys the deferred component manager. - `getDeferredComponentInstallState(int, String)`: Retrieves the installation state of a deferred component. - `installDeferredComponent(int, String)`: Installs a deferred component. - `uninstallDeferredComponent(int, String)`: Uninstalls a deferred component. ``` -------------------------------- ### Initialize Apphud SDK and Set Listener Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/README.md Initializes the Apphud SDK with your API key and user ID, and sets up a listener for SDK events. Ensure you replace 'your-api-key' and 'user@example.com' with your actual values. ```dart final user = await Apphud.start( apiKey: 'your-api-key', userID: 'user@example.com', ); await Apphud.setListener(listener: MyListener()); ``` -------------------------------- ### Google Play Core Split Install API Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Details on classes and methods related to Google Play Core Split Install functionality. ```APIDOC ## com.google.android.play.core.splitinstall.zzbe ### Description Provides methods for managing split installations. ### Methods - `zzc(java.util.Collection)`: Final void method. - `zzd(java.util.Collection)`: Final void method. ## com.google.android.play.core.splitinstall.zzn ### Description Represents a component for split installation. ### Methods - `()`: Private constructor. ## com.google.android.play.core.splitinstall.zzq ### Description Interface for retrieving split installation information. ### Methods - `zza()`: Public abstract method returning a Set. ## com.google.android.play.core.splitinstall.zzr ### Description Provides static access to split installation information. ### Methods - `zza()`: Static method returning a `zzq` object. ## com.google.android.play.core.splitinstall.zzs ### Description Handles split installation operations. ### Methods - `(android.content.Context, java.lang.String)`: Constructor. - `zza()`: Public final method returning a `zzk` object. - `zzc()`: Public final method returning a Set. - `zzd()`: Public final method returning a Set. - `zzg()`: Private final method returning an android.os.Bundle. - `zzh()`: Private final method returning a Set. ## com.google.android.play.core.splitinstall.zzx ### Description Manages listeners for split install state updates. ### Methods - `zzk(com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener)`: Final synchronized method. - `zzl(com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener)`: Final synchronized method. ``` -------------------------------- ### Initialize Apphud SDK with API Key and User ID Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/configuration.md Use `Apphud.start()` for primary SDK initialization with your API key and an optional custom user ID. This is the recommended method for most use cases. ```dart static Future start({ required String apiKey, String? userID, bool? observerMode, String? baseUrl, }) ``` ```dart void initializeApphud() async { final user = await Apphud.start( apiKey: 'sk_live_your_key_here', userID: 'user@example.com', ); } ``` -------------------------------- ### ProductDetails$InstallmentPlanDetails Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Provides details regarding installment plans for products. ```APIDOC ## ProductDetails$InstallmentPlanDetails ### Description Retrieves information about installment plan commitments. ### Methods - **getInstallmentPlanCommitmentPaymentsCount()**: Returns the count of commitment payments. - **getSubsequentInstallmentPlanCommitmentPaymentsCount()**: Returns the count of subsequent commitment payments. ``` -------------------------------- ### TimeWindow Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Provides methods to access the start and end times of a time window. ```APIDOC ## TimeWindow ### Description Represents a time window defined by a start and end timestamp. This class allows retrieval of these timestamps and provides a builder for creating TimeWindow objects. ### Methods - `getEndMs()`: Returns the end timestamp of the time window in milliseconds. - `getStartMs()`: Returns the start timestamp of the time window in milliseconds. - `newBuilder()`: Creates and returns a new `TimeWindow.Builder` instance. ``` -------------------------------- ### WindowInsetsControllerCompat Methods Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Provides methods for managing system bars and window inset animations. ```APIDOC ## WindowInsetsControllerCompat Methods ### Description Provides methods for managing system bars and window inset animations. ### Methods - `addOnControllableInsetsChangedListener(androidx.core.view.WindowInsetsControllerCompat$OnControllableInsetsChangedListener)` - `controlWindowInsetsAnimation(int, long, android.view.animation.Interpolator, android.os.CancellationSignal, androidx.core.view.WindowInsetsAnimationControlListenerCompat)` - `getSystemBarsBehavior()` - `hide(int)` - `isAppearanceLightNavigationBars()` - `isAppearanceLightStatusBars()` - `removeOnControllableInsetsChangedListener(androidx.core.view.WindowInsetsControllerCompat$OnControllableInsetsChangedListener)` - `setSystemBarsBehavior(int)` - `show(int)` - `toWindowInsetsControllerCompat(android.view.WindowInsetsController)` ### Constants - `BEHAVIOR_DEFAULT` - `BEHAVIOR_SHOW_BARS_BY_SWIPE` - `BEHAVIOR_SHOW_BARS_BY_TOUCH` - `BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE` ``` -------------------------------- ### Get Product Details Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Retrieves details for a specific in-app product by its ID. ```APIDOC ## Get Product Details ### Description Retrieves details for a specific in-app product by its ID. ### Method `Apphud.product` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **productId** (string) - Required - The ID of the product to retrieve. ### Request Example ```dart final product = await Apphud.product('product_id'); if (product?.skProductWrapper != null) { print('iOS price: ${product!.skProductWrapper!.price}'); } ``` ### Response #### Success Response - **product** (ApphudProduct?) - The product details object, or null if not found. ``` -------------------------------- ### setHost Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Sets a custom API host URL. Must be called before `start()` or `startManually()`. ```APIDOC ## setHost ### Description Sets a custom API host URL. Must be called before `start()` or `startManually()`. ### Method `static Future` ### Parameters #### Path Parameters - **host** (String) - Required - Custom API base URL. ### Request Example ```dart await Apphud.setHost('https://custom.apphud.com'); ``` ``` -------------------------------- ### Apphud SDK Initialization Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/seeds.txt Initializes the Apphud SDK with the necessary context and API keys. ```APIDOC ## Apphud.start ### Description Initializes the Apphud SDK. This must be called to start tracking and managing subscriptions. ### Method void ### Parameters - **context** (android.content.Context) - Required - The application context. - **apiKey** (java.lang.String) - Required - Your Apphud API key. - **userId** (java.lang.String) - Optional - Custom user ID. - **deviceId** (java.lang.String) - Optional - Custom device ID. - **observerMode** (boolean) - Required - Whether to run in observer mode. - **callback** (kotlin.jvm.functions.Function1) - Optional - Initialization callback. ``` -------------------------------- ### Coroutine Intrinsics APIs Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt APIs for starting and managing coroutines with different dispatching strategies. ```APIDOC ## CancellableKt ### Description Provides utilities for safely running and starting cancellable coroutines. ### Methods - `runSafely(Continuation, Function0)`: Safely runs a block of code within a continuation. - `startCoroutineCancellable(Function1, Continuation)`: Starts a coroutine in a cancellable manner. ## UndispatchedKt ### Description Offers functions for starting coroutines with specific dispatching behaviors, including undispatched and unintercepted execution. ### Methods - `startCoroutineUndispatched(Function1, Continuation)`: Starts a coroutine with undispatched execution. - `startCoroutineUnintercepted(Function1, Continuation)`: Starts a coroutine without interception. - `startDirect(Continuation, Function1)`: Starts a coroutine directly. - `startUndispatchedOrReturnIgnoreTimeout(ScopeCoroutine, Object, Function2)`: Starts a coroutine undispatched, ignoring timeout. - `undispatchedResult(ScopeCoroutine, Function1, Function0)`: Gets the result of an undispatched coroutine. ``` -------------------------------- ### WindowInsetsControllerCompat Methods Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Details methods for controlling system bars and window insets. ```APIDOC ## WindowInsetsControllerCompat Methods ### Description Methods for controlling system bars (status bar, navigation bar) and window insets, including showing, hiding, and animation control. ### Methods - `addOnControllableInsetsChangedListener(androidx.core.view.WindowInsetsControllerCompat$OnControllableInsetsChangedListener listener)`: Adds a listener for changes in controllable insets. - `controlWindowInsetsAnimation(int type, long durationMillis, android.view.animation.Interpolator interpolator, android.os.CancellationSignal signal, androidx.core.view.WindowInsetsAnimationControlListenerCompat listener)`: Controls a window inset animation. - `getSystemBarsBehavior()`: Gets the behavior of system bars. - `hide(int type)`: Hides the specified type of system bars. - `removeOnControllableInsetsChangedListener(androidx.core.view.WindowInsetsControllerCompat$OnControllableInsetsChangedListener listener)`: Removes a listener for changes in controllable insets. - `setSystemBarsBehavior(int behavior)`: Sets the behavior for system bars. - `show(int type)`: Shows the specified type of system bars. - `isAppearanceLightStatusBars()`: Checks if the status bar has a light appearance. - `isAppearanceLightNavigationBars()`: Checks if the navigation bar has a light appearance. ``` -------------------------------- ### ResolvableApiException API Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt An exception that can be resolved by the user, typically by starting an activity to handle the resolution. ```APIDOC ## ResolvableApiException API ### Description This exception indicates that an operation failed but can be resolved by the user. It provides a `PendingIntent` that can be used to start an activity to prompt the user for resolution. ### Methods - `getResolution()`: Returns the `PendingIntent` that can be used to start the resolution activity. - `startResolutionForResult(Activity activity, int requestCode)`: Starts the activity to resolve the error. The result will be delivered to the activity's `onActivityResult` method. ``` -------------------------------- ### OkHttp Protocol Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Provides functionality to get an OkHttp Protocol object from a string representation. ```APIDOC ## OkHttp Protocol ### Description Provides functionality to get an OkHttp Protocol object. ### Method - `get(String name)`: Returns the Protocol for the given string name. ``` -------------------------------- ### Array Index and Range Utilities Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Functions to get the indices and the last index of an array. ```APIDOC ## Array Index and Range Utilities ### Description Provides utilities to retrieve the range of valid indices for an array and the index of the last element. ### Methods #### `getIndices` Returns the range of indices for the given array. - **Parameters**: - `array` (ArrayType) - The input array. - **Returns**: - `kotlin.ranges.IntRange` - An `IntRange` object representing the indices of the array. #### `getLastIndex` Returns the index of the last element in the array. - **Parameters**: - `array` (ArrayType) - The input array. - **Returns**: - `int` - The index of the last element. ### Supported Array Types for `getIndices` and `getLastIndex`: - `byte[]` - `char[]` - `double[]` - `float[]` - `int[]` - `long[]` - `java.lang.Object[]` - `short[]` - `boolean[]` ``` -------------------------------- ### Gson Library Usage Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/seeds.txt Examples of using the Gson library for JSON serialization and deserialization. ```APIDOC ## Gson Library Usage ### Description Demonstrates the usage of the Gson library for JSON processing within the SDK. ### Methods #### `JsonPrimitive.isBoolean()` - **Description**: Checks if the JSON primitive is a boolean. - **Method**: `boolean` - **Endpoint**: N/A (Gson utility) #### `JsonSerializationContext.serialize(Object, Type)` - **Description**: Serializes a Java object into a JSON element. - **Method**: `JsonElement` - **Parameters**: - `src` (Object) - Required - The object to serialize. - `typeOfSrc` (Type) - Required - The type of the object. - **Endpoint**: N/A (Gson utility) #### `LinkedTreeMap$LinkedTreeMapIterator.remove()` - **Description**: Removes the last returned element from the map iterator. - **Method**: `void` - **Endpoint**: N/A (Gson utility) #### `LinkedTreeMap.remove(Object)` - **Description**: Removes a key-value pair from the linked tree map. - **Method**: `Object` - **Parameters**: - `key` (Object) - Required - The key to remove. - **Endpoint**: N/A (Gson utility) #### `LinkedTreeMap$KeySet.size()` - **Description**: Returns the number of keys in the map. - **Method**: `int` - **Endpoint**: N/A (Gson utility) #### `ConstructorConstructor.newUnsafeAllocator(Class)` - **Description**: Creates an unsafe allocator for a given class. - **Method**: `ObjectConstructor` - **Parameters**: - `type` (Class) - Required - The class to create an allocator for. - **Endpoint**: N/A (Gson utility) #### `DefaultDateTypeAdapter.read(JsonReader)` - **Description**: Reads a date from a JSON reader. - **Method**: `Object` - **Parameters**: - `in` (JsonReader) - Required - The JSON reader. - **Endpoint**: N/A (Gson utility) #### `NumberTypeAdapter.read(JsonReader)` - **Description**: Reads a number from a JSON reader. - **Method**: `Object` - **Parameters**: - `in` (JsonReader) - Required - The JSON reader. - **Endpoint**: N/A (Gson utility) #### `SqlTypesSupport$2.SqlTypesSupport$2(Class)` - **Description**: Constructor for SqlTypesSupport$2. - **Method**: `SqlTypesSupport$2` - **Parameters**: - `type` (Class) - Required - The type to support. - **Endpoint**: N/A (Gson utility) ``` -------------------------------- ### checkEligibilityForIntroductoryOffer Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md iOS only. Checks if user is eligible for a product's introductory offer (free trial or pay-as-you-go intro price). ```APIDOC ## checkEligibilityForIntroductoryOffer ### Description iOS only. Checks if user is eligible for a product's introductory offer (free trial or pay-as-you-go intro price). User is eligible when: 1. Product has non-null introductory price 2. User never used an introductory offer in the same subscription group on current Apple ID ### Method `static Future` ### Parameters #### Path Parameters - **productId** (String) - Required - Product identifier to check. ### Response #### Success Response - **eligible** (bool) - True if eligible. False on Android, when product not loaded, or user already used offer. ### Request Example ```dart await Apphud.checkEligibilityForIntroductoryOffer(productId: 'your-product-id'); ``` ### Response Example ```dart // Returns true if eligible, false otherwise. // Example: true ``` ``` -------------------------------- ### FlutterEngine Initialization Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Methods for initializing the FlutterEngine instance. ```APIDOC ## FlutterEngine ### Description Represents the Flutter engine instance that executes Dart code. ### Constructors - **FlutterEngine(Context)**: Initializes with default loader and JNI. - **FlutterEngine(Context, FlutterLoader, FlutterJNI)**: Initializes with custom loader and JNI components. ``` -------------------------------- ### Get Error String Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Retrieves a string describing a Google Play services error code. ```APIDOC ## getErrorString ### Description Returns a string describing the given Google Play services error code. ### Method `getErrorString(int errorCode)` ### Parameters - **errorCode** (int) - Required - The error code returned by Google Play services. ### Return Value - `java.lang.String` - A string describing the error. ``` -------------------------------- ### StateFlow Operations Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Details on how to interact with and manage `StateFlow` instances, including getting values and updating them. ```APIDOC ## StateFlow Operations ### Description Provides methods for interacting with `StateFlow`, including retrieving its current value and updating it atomically. ### Method `public abstract java.lang.Object getValue()` `public boolean compareAndSet(java.lang.Object expect, java.lang.Object update)` `public void resetReplayCache()` `public boolean tryEmit(java.lang.Object value)` `public static final java.lang.Object getAndUpdate(kotlinx.coroutines.flow.MutableStateFlow, kotlin.jvm.functions.Function1 updateFunction) `public static final void update(kotlinx.coroutines.flow.MutableStateFlow, kotlin.jvm.functions.Function1 updateFunction) `public static final java.lang.Object updateAndGet(kotlinx.coroutines.flow.MutableStateFlow, kotlin.jvm.functions.Function1 updateFunction) ### Endpoint N/A (Internal SDK methods) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Depends on the method called. `getValue` returns the current state. `compareAndSet` and `tryEmit` return a boolean indicating success. `getAndUpdate` and `updateAndGet` return the new state. #### Response Example None ``` -------------------------------- ### ActivityOptionsCompat API Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Helper class for configuring Activity launch options, including animations and transitions. ```APIDOC ## ActivityOptionsCompat ### Description Provides methods to create ActivityOptions for various launch scenarios, such as custom animations, scene transitions, and task management. ### Key Methods - **makeBasic()**: Creates a basic ActivityOptions instance. - **makeClipRevealAnimation(View view, int x, int y, int width, int height)**: Creates an animation where the activity reveals from a clip. - **makeCustomAnimation(Context context, int enterResId, int exitResId)**: Creates a custom animation for activity transition. - **makeSceneTransitionAnimation(Activity activity, View sharedElement, String name)**: Creates a scene transition animation for shared elements. - **makeTaskLaunchBehind()**: Creates options to launch a task behind the current one. - **setLaunchBounds(Rect screenSpacePixelRect)**: Sets the bounds for the activity launch. ``` -------------------------------- ### Implement Paywalls with Real-time Segmentation Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Initialize Apphud, defer placements, set user properties, and fetch placements for real-time segmentation. This allows for dynamic paywall content based on user attributes. ```dart await Apphud.start(apiKey: 'key'); await Apphud.deferPlacements(); await Apphud.setUserProperty(key: ApphudUserPropertyKey.customProperty('tier'), value: 'gold'); await Apphud.forceFlushUserProperties(); final placements = await Apphud.fetchPlacements(); ``` -------------------------------- ### Get All Subscriptions Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Retrieves all subscriptions a user has ever purchased. Useful for managing multiple subscription groups. ```dart static Future> subscriptions() ``` ```dart void checkAllSubscriptions() async { final subs = await Apphud.subscriptions(); for (final sub in subs) { print('Product: ${sub.productId}, Active: ${sub.isActive}'); } } ``` -------------------------------- ### Attribution and SDK Initialization Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/seeds.txt Handles attribution tracking and SDK initialization processes. ```APIDOC ## tryWebAttribution ### Description Attempts to process web attribution data. ### Method N/A (This appears to be an internal method call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java // Example usage within the SDK's internal code ApphudInternalKt.tryWebAttribution(...); ``` ### Response #### Success Response (200) - **Object** - Result of the attribution attempt. #### Response Example ```json { "example": "Attribution result" } ``` ``` -------------------------------- ### Get current User ID Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Returns the current user ID. This value may change at runtime. ```dart static Future userID() ``` ```dart void checkUserId() async { final id = await Apphud.userID(); print('Current user ID: $id'); } ``` -------------------------------- ### Get User ID Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Retrieves the current user's unique identifier as set during initialization or by Apphud. ```APIDOC ## Get User ID ### Description Retrieves the current user's unique identifier as set during initialization or by Apphud. ### Method `Apphud.userID` ### Parameters None ### Request Example ```dart final user = await Apphud.userID(); ``` ### Response #### Success Response - **userID** (string) - The unique identifier for the current user. ``` -------------------------------- ### IconCompat Constants and Helper Methods Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/usage.txt Details on constants and helper methods related to IconCompat, including resource loading and shortcut intent creation. ```APIDOC ## IconCompat Constants and Helper Methods This section covers constants and helper methods associated with `IconCompat` and related functionalities. ### TYPE_URI_ADAPTIVE_BITMAP A constant representing the type for adaptive bitmap URIs. - **Type**: int - **Value**: `public static final int TYPE_URI_ADAPTIVE_BITMAP` ### addToShortcutIntent Adds an icon to a shortcut intent. - **Method**: instance - **Endpoint**: N/A - **Parameters**: - **intent** (android.content.Intent) - Required - The intent to add the icon to. - **icon** (android.graphics.drawable.Drawable) - Required - The drawable icon to add. - **context** (android.content.Context) - Required - The context. ### checkResource Checks the resource associated with the icon. - **Method**: instance - **Endpoint**: N/A - **Parameters**: - **context** (android.content.Context) - Required - The context to use for checking resources. ### getResources Retrieves resources for a given context and package name. - **Method**: static - **Endpoint**: N/A (Helper method) - **Parameters**: - **context** (android.content.Context) - Required - The context. - **packageName** (java.lang.String) - Required - The name of the package. - **Returns**: android.content.res.Resources - The Resources object. ### loadDrawable Loads the drawable representation of the icon. - **Method**: instance - **Endpoint**: N/A - **Parameters**: - **context** (android.content.Context) - Required - The context to use for loading the drawable. - **Returns**: android.graphics.drawable.Drawable - The loaded drawable. ### loadDrawableInner An internal method for loading the drawable. - **Method**: private instance - **Endpoint**: N/A - **Parameters**: - **context** (android.content.Context) - Required - The context. - **Returns**: android.graphics.drawable.Drawable - The loaded drawable. ``` -------------------------------- ### Gson Library Usage Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/seeds.txt Examples of using the Gson library for JSON serialization and deserialization within the SDK. ```APIDOC ## Gson$htmlSafe ### Description Checks if HTML is escaped in JSON output. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **htmlSafe**() - Returns a boolean indicating if HTML is safe. ## Gson$longAdapter ### Description Provides a TypeAdapter for long values. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## GsonBuilder$setObjectToNumberStrategy ### Description Sets the strategy for converting JSON numbers to Java Objects. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## JsonPrimitive$deepCopy ### Description Creates a deep copy of a JsonPrimitive. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **deepCopy**() - Returns a deep copy of the JsonPrimitive. ## ReflectiveTypeAdapterFactory$Adapter$read ### Description Reads a JSON object and deserializes it into a Java object. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **read**(JsonReader) - Reads from the JsonReader and returns the deserialized object. ## ReflectiveTypeAdapterFactory$Adapter ### Description Constructor for the ReflectiveTypeAdapterFactory$Adapter. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## TypeAdapters$26$write ### Description Writes a Java object to a JsonWriter. ### Method N/A (Internal method) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### ViewCompat Methods Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt This section lists the available methods in the ViewCompat class, including those for accessibility, unhandled key event listeners, and view identification. ```APIDOC ## ViewCompat Methods ### addOnUnhandledKeyEventListener **Description**: Adds a listener to be notified of unhandled key events. ### getAccessibilityPaneTitle **Description**: Gets the accessibility pane title for a view. ### isAccessibilityHeading **Description**: Checks if a view is an accessibility heading. ### isScreenReaderFocusable **Description**: Checks if a view is focusable by the screen reader. ### removeOnUnhandledKeyEventListener **Description**: Removes a listener for unhandled key events. ### requireViewById **Description**: Safely retrieves a view by its ID, throwing an exception if not found. ### setAccessibilityHeading **Description**: Sets whether a view is an accessibility heading. ### setAccessibilityPaneTitle **Description**: Sets the accessibility pane title for a view. ### setAutofillId **Description**: Sets the autofill ID for a view. ### setScreenReaderFocusable **Description**: Sets whether a view is focusable by the screen reader. ``` -------------------------------- ### Track Attribution Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/index.md Set attribution data for tracking marketing campaign performance. This example uses AppsFlyer as the provider. ```dart await Apphud.setAttribution( provider: ApphudAttributionProvider.appsFlyer, data: attributionData, identifier: appsFlyerId, ); ``` -------------------------------- ### BillingClient Initialization Source: https://github.com/apphud/apphudsdk-flutter/blob/main/example/android/app/build/outputs/mapping/debug/mapping.txt Initializes the BillingClient with various configurations. ```APIDOC ## BillingClient Initialization ### Description Initializes the BillingClient with different sets of parameters. ### Methods - `(java.lang.String, android.content.Context, com.android.billingclient.api.zzch, java.util.concurrent.ExecutorService)` - `(java.lang.String, com.android.billingclient.api.PendingPurchasesParams, android.content.Context, com.android.billingclient.api.zzco, com.android.billingclient.api.zzch, java.util.concurrent.ExecutorService)` - `(java.lang.String, com.android.billingclient.api.PendingPurchasesParams, android.content.Context, com.android.billingclient.api.PurchasesUpdatedListener, com.android.billingclient.api.zzb, com.android.billingclient.api.zzch, java.util.concurrent.ExecutorService)` ``` -------------------------------- ### Set Custom API Host Source: https://github.com/apphud/apphudsdk-flutter/blob/main/_autodocs/api-reference/apphud-main.md Sets a custom API host URL for the Apphud SDK. This must be called before starting the SDK. ```dart static Future setHost(String host) ``` ```dart void useCustomHost() async { await Apphud.setHost('https://custom.apphud.com'); await Apphud.start(apiKey: 'your-api-key'); } ```