-
public class Purchasely
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classPurchasely.BuilderBuilder class for configuring the PurchaseLy SDK. Must be called before method start() configure SDK.
-
Field Summary
Fields Modifier and Type Field Description private final static <ERROR CLASS>anonymousUserIdprivate static LongnetworkTimeOutprivate static ObjectplayerViewprivate static Function0<ImageView>lottieViewprivate static EventListenereventListenerprivate static UserAttributeListeneruserAttributeListenerprivate static PLYUIHandleruiHandlerprivate static PurchaseListenerpurchaseListenerprivate static LogLevellogLevelprivate static BooleanrecordLogsprivate static PLYAppTechnologyappTechnologyprivate static StringsdkBridgeVersionprivate final static StringsdkVersionprivate static BooleanreadyToOpenDeeplinkprivate static PLYRunningModerunningModeprivate static Localelanguagepublic final static PurchaselyINSTANCE
-
Method Summary
Modifier and Type Method Description final static UnituserLogin(String userId, Function1<Boolean, Unit> callback)Login the user with the provided userId. final static UnituserLogout(Boolean clearUserAttributes)Logout the current user. final static BooleanisAnonymous()final static UnitaddLogger(PLYLogging logging)final static LiveData<PLYPlan>livePurchase()Provide a stream of purchased plans. final LiveData<State>getPurchaseStateLiveData()Retrieve the current purchase state. final StateFlow<State>getPurchaseState()Retrieve the current purchase state. final static Unitstart(Function2<Boolean, PLYError, Unit> initialized)Mandatory function to start using SDK. final static Unitstart()Mandatory function to start using SDK. final static BooleanisStarted()Check if the SDK is started You don't really need to check that, the SDK will automatically managed its state start should be called in your Application class in the method onCreate final static Unitclose()Close the SDK and release resources If you need the SDK again, you must call start final static UnitcloseAllScreens()Closes all currently open screens managed by Purchasely. final static PLYPresentationViewpresentationView(Context context, String placementId, PLYPresentationProperties properties, Function2<PLYProductViewResult, PLYPlan, Unit> callback)Retrieve view to display a presentation. final static PLYPresentationViewpresentationView(Context context, String placementId, PLYPresentationProperties properties)Retrieve view to display a presentation. final static PLYPresentationViewpresentationView(Context context, String placementId)Retrieve view to display a presentation. final static PLYPresentationViewpresentationView(Context context)Retrieve view to display a presentation. final static UnitfetchPresentation(String placementId, PLYPresentationProperties properties, @NonNull() Function2<PLYPresentation, PLYError, Unit> callback)Fetch a presentation for the provided properties and invokes the callback upon completion. final static UnitfetchPresentation(String placementId, @NonNull() Function2<PLYPresentation, PLYError, Unit> callback)Fetch a presentation for the provided properties and invokes the callback upon completion. final static UnitfetchPresentation(@NonNull() Function2<PLYPresentation, PLYError, Unit> callback)Fetch a presentation for the provided properties and invokes the callback upon completion. final static UnitclientPresentationDisplayed(PLYPresentation presentation)final static UnitclientPresentationClosed(PLYPresentation presentation)final static UnitallProducts(Function1<List<PLYProduct>, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieve list of products for purchase. final static UnitallProducts(ProductsListener callback)Retrieve list of products for purchase. final List<PLYProduct>allProducts()Retrieve list of products for purchase. final PLYProductproduct(String vendorId)Retrieve the product having vendorId. final static Unitproduct(String vendorId, Function1<PLYProduct, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieve the product having vendorId. final static Unitproduct(String vendorId, ProductListener callback)Retrieve the product having vendorId. final PLYPlanplan(String vendorId)Retrieve the plan having vendorId. final static Unitplan(String vendorId, Function1<PLYPlan, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieve the plan having vendorId. final static Unitplan(String vendorId, PlanListener callback)Retrieve the plan having vendorId. final PLYPlanplan(String sku, String basePlanId)Retrieves a PLYPlan matching a given SKU and optionally a base plan ID. final static Unitplan(String sku, String basePlanId, Function1<PLYPlan, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieves a Purchasely Plan associated with a specific product SKU. final static Unitpurchase(Activity activity, PLYPlan plan, PLYPromoOffer offer, String contentId, Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)Purchase a plan directly. final static UnitrestoreAllProducts(Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)Initiate restoration for all previous purchases. final static UnitsilentRestoreAllProducts(Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)Restore previous purchases. final static Unitsynchronize()Synchronize purchases from your own in-app purchase system with Purchasely. final static UnitdisplaySubscriptionCancellationInstruction(Activity activity, @StyleRes() Integer themeId)Display a dialog informing the user how to cancel his subscription. final static PLYPurchaseFragmentsubscriptionsFragment()final static UnituserSubscriptions(Boolean invalidateCache, SubscriptionsListener callback)Retrieve user's active subscriptions. final static UnituserSubscriptions(Boolean invalidateCache, Function1<List<PLYSubscriptionData>, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieve user's active subscriptions information. final List<PLYSubscriptionData>userSubscriptions(Boolean invalidateCache)Retrieve user's active subscriptions. final UnituserSubscriptionsHistory(Boolean invalidateCache, SubscriptionsListener callback)Retrieve user's expired subscriptions. final UnituserSubscriptionsHistory(Boolean invalidateCache, Function1<List<PLYSubscriptionData>, Unit> onSuccess, Function1<Throwable, Unit> onError)Retrieve user's expired subscriptions. final List<PLYSubscriptionData>userSubscriptionsHistory(Boolean invalidateCache)Retrieve user's expired subscriptions. final List<PLYPlan>purchaseHistory()Retrieve the purchase history. final BooleanisPastSubscriber()Check whether the user is a past subscriber. final static BooleanisDeeplinkHandled(Uri deeplink, Activity activity)Attempts to handle the provided deeplink, potentially by queuing it for processing. final static Map<String, Object>getBuiltInAttributes()Retrieve all built-in attributes. final static ObjectgetBuiltInAttribute(String key)Retrieve a built-in attribute by its key. final static UnitsetAttribute(Attribute attribute, String value)final static Unit)>setAttributes(<ERROR CLASS><Attribute, String> attributes)final static UnitsetPaywallActionsInterceptor(Function4<PLYPresentationInfo, PLYPresentationAction, PLYPresentationActionParameters, Function1<Boolean, Unit>, Unit> handler)final static UnitsetPaywallActionsInterceptor(PLYPaywallActionListener handler)final static UnitsetDefaultPresentationResultHandler(Function2<PLYProductViewResult, PLYPlan, Unit> handler)final static UnituserDidConsumeSubscriptionContent()final static List<String>retrieveLogs()Retrieve recorded logs from the PurchaseLy SDK. final static ObjectuserAttribute(String key)Retrieve the value of a user attribute. final static Map<String, Object>userAttributes()Retrieve all user attributes. final static UnitsetUserAttribute(String key, String value)Set a user attribute with a String value. final static UnitsetUserAttribute(String key, Integer value)Set a user attribute with an Int value. final static UnitsetUserAttribute(String key, Float value)Set a user attribute with a Float value. final static UnitsetUserAttribute(String key, Boolean value)Set a user attribute with a Boolean value. final static UnitsetUserAttribute(String key, Date value)Set a user attribute with a Date value. final static UnitsetUserAttribute(String key, Instant value)Set a user attribute with an Instant value. final static UnitsetUserAttribute(String key, Array<String> values)final static UnitsetUserAttribute(String key, Array<Integer> values)final static UnitsetUserAttribute(String key, Array<Float> values)final static UnitsetUserAttribute(String key, Array<Boolean> values)final static UnitsetUserAttributes(Map<String, Object> map)Set multiple user attributes. final static UnitincrementUserAttribute(String key, Integer value)Increment a user attribute with an optional Int value. final static UnitincrementUserAttribute(String key)Increment a user attribute with an optional Int value. final static UnitdecrementUserAttribute(String key, Integer value)Decrement a user attribute with an optional Int value. final static UnitdecrementUserAttribute(String key)Decrement a user attribute with an optional Int value. final static UnitclearUserAttributes()Clear all user attributes. final static UnitclearUserAttribute(String key)Clear a specific user attribute. final UnitclearBuiltInAttributes()Clear all built-in attributes. final BooleansetDynamicOffering(String reference, String planVendorId, String offerVendorId)Add a dynamic offering to the Purchasely SDK. final static UnitsetDynamicOffering(String reference, String planVendorId, String offerVendorId, Function1<Boolean, Unit> callback)Set a dynamic offering to the Purchasely SDK. final List<PLYDynamicOffering>getDynamicOfferings()Retrieve all dynamic offerings stored in the Purchasely SDK. final static UnitgetDynamicOfferings(Function1<List<PLYDynamicOffering>, Unit> callback)Retrieve all dynamic offerings stored in the Purchasely SDK. final static UnitremoveDynamicOffering(String reference)Remove the dynamic offering with the specified reference from the Purchasely SDK. final static UnitclearDynamicOfferings()Clear all dynamic offerings stored in the Purchasely SDK. final static UnitsetThemeMode(PLYThemeMode mode)Set the theme mode for the Purchasely SDK. final static PLYThemeModegetThemeMode()Get the current theme mode for the Purchasely SDK. final static <ERROR CLASS>getAnonymousUserId()final static LonggetNetworkTimeOut()The time amount to wait for network requests. final static UnitsetNetworkTimeOut(Long networkTimeOut)The time amount to wait for network requests. final static ObjectgetPlayerView()Your can provide your own video player It must implements PLYPlayerInterface final static UnitsetPlayerView(Object playerView)Your can provide your own video player It must implements PLYPlayerInterface final static Function0<ImageView>getLottieView()Your can provide your own lottie view It must implements PLYLottieInterface final static UnitsetLottieView(Function0<ImageView> lottieView)Your can provide your own lottie view It must implements PLYLottieInterface final static EventListenergetEventListener()Listener for purchase events. final static UnitsetEventListener(EventListener eventListener)Listener for purchase events. final static UserAttributeListenergetUserAttributeListener()Listener for user attributes. final static UnitsetUserAttributeListener(UserAttributeListener userAttributeListener)Listener for user attributes. final static PLYUIHandlergetUiHandler()final static UnitsetUiHandler(PLYUIHandler uiHandler)final static PurchaseListenergetPurchaseListener()Listener for purchase events. final static UnitsetPurchaseListener(PurchaseListener purchaseListener)Listener for purchase events. final static LogLevelgetLogLevel()The log level used by the Purchasely SDK. final static UnitsetLogLevel(LogLevel logLevel)The log level used by the Purchasely SDK. final static BooleangetRecordLogs()Whether to record logs. final static UnitsetRecordLogs(Boolean recordLogs)Whether to record logs. final static PLYAppTechnologygetAppTechnology()The technology used by the Purchasely SDK. final static UnitsetAppTechnology(PLYAppTechnology appTechnology)The technology used by the Purchasely SDK. final static StringgetSdkBridgeVersion()The version of the Purchasely SDK bridge (non-native). final static UnitsetSdkBridgeVersion(String sdkBridgeVersion)The version of the Purchasely SDK bridge (non-native). final static StringgetSdkVersion()The version of the Purchasely SDK. final static BooleangetReadyToOpenDeeplink()Whether the SDK is ready to open deep links. final static UnitsetReadyToOpenDeeplink(Boolean readyToOpenDeeplink)final static PLYRunningModegetRunningMode()The running mode of the Purchasely SDK. final static UnitsetRunningMode(PLYRunningMode runningMode)The running mode of the Purchasely SDK. final static LocalegetLanguage()The language used by the Purchasely SDK. final static UnitsetLanguage(Locale language)The language used by the Purchasely SDK. -
-
Method Detail
-
userLogin
final static Unit userLogin(String userId, Function1<Boolean, Unit> callback)
Login the user with the provided userId.
- Parameters:
userId- the user id to login.callback- callback to handle the login result.
-
userLogout
final static Unit userLogout(Boolean clearUserAttributes)
Logout the current user.
- Parameters:
clearUserAttributes- whether to clear user attributes.
-
isAnonymous
final static Boolean isAnonymous()
-
addLogger
final static Unit addLogger(PLYLogging logging)
-
livePurchase
final static LiveData<PLYPlan> livePurchase()
Provide a stream of purchased plans.
-
getPurchaseStateLiveData
final LiveData<State> getPurchaseStateLiveData()
Retrieve the current purchase state.
-
getPurchaseState
final StateFlow<State> getPurchaseState()
Retrieve the current purchase state.
-
start
final static Unit start(Function2<Boolean, PLYError, Unit> initialized)
Mandatory function to start using SDK. Must be called with building SDK with Purchasely.Builder.
Should be called from your Application class in the onCreate method.
- Parameters:
initialized- callback indicating successful configuration and providing a PLYError in case of errors.
-
start
final static Unit start()
Mandatory function to start using SDK. Must be called with building SDK with Purchasely.Builder.
Should be called from your Application class in the onCreate method.
-
isStarted
final static Boolean isStarted()
Check if the SDK is started You don't really need to check that, the SDK will automatically managed its state start should be called in your Application class in the method onCreate
-
close
final static Unit close()
Close the SDK and release resources If you need the SDK again, you must call start
-
closeAllScreens
final static Unit closeAllScreens()
Closes all currently open screens managed by Purchasely.
-
presentationView
@JvmOverloads() final static PLYPresentationView presentationView(Context context, String placementId, PLYPresentationProperties properties, Function2<PLYProductViewResult, PLYPlan, Unit> callback)
Retrieve view to display a presentation.
- Parameters:
context- android context.properties- the presentation properties.callback- listener for a purchase or an error with associated plan.
-
presentationView
@JvmOverloads() final static PLYPresentationView presentationView(Context context, String placementId, PLYPresentationProperties properties)
Retrieve view to display a presentation.
- Parameters:
context- android context.properties- the presentation properties.
-
presentationView
@JvmOverloads() final static PLYPresentationView presentationView(Context context, String placementId)
Retrieve view to display a presentation.
- Parameters:
context- android context.
-
presentationView
@JvmOverloads() final static PLYPresentationView presentationView(Context context)
Retrieve view to display a presentation.
- Parameters:
context- android context.
-
fetchPresentation
@JvmOverloads() final static Unit fetchPresentation(String placementId, PLYPresentationProperties properties, @NonNull() Function2<PLYPresentation, PLYError, Unit> callback)
Fetch a presentation for the provided properties and invokes the callback upon completion.
- Parameters:
properties- The properties of the presentation view.callback- callback providing the fetched PLYPresentation or a PLYError.
-
fetchPresentation
@JvmOverloads() final static Unit fetchPresentation(String placementId, @NonNull() Function2<PLYPresentation, PLYError, Unit> callback)
Fetch a presentation for the provided properties and invokes the callback upon completion.
- Parameters:
callback- callback providing the fetched PLYPresentation or a PLYError.
-
fetchPresentation
@JvmOverloads() final static Unit fetchPresentation(@NonNull() Function2<PLYPresentation, PLYError, Unit> callback)
Fetch a presentation for the provided properties and invokes the callback upon completion.
- Parameters:
callback- callback providing the fetched PLYPresentation or a PLYError.
-
clientPresentationDisplayed
final static Unit clientPresentationDisplayed(PLYPresentation presentation)
-
clientPresentationClosed
final static Unit clientPresentationClosed(PLYPresentation presentation)
-
allProducts
final static Unit allProducts(Function1<List<PLYProduct>, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieve list of products for purchase.
- Parameters:
onSuccess- callback to receive the list of retrieved products.onError- callback to handle errors during product retrieval.
-
allProducts
final static Unit allProducts(ProductsListener callback)
Retrieve list of products for purchase.
- Parameters:
callback- callback to receive product information or handle errors.
-
allProducts
final List<PLYProduct> allProducts()
Retrieve list of products for purchase.
-
product
final PLYProduct product(String vendorId)
Retrieve the product having vendorId.
- Parameters:
vendorId- the vendor id of the product to fetch.
-
product
final static Unit product(String vendorId, Function1<PLYProduct, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieve the product having vendorId.
- Parameters:
vendorId- the vendor id of the product to fetch.onSuccess- callback for successful product retrieval.onError- callback for handling errors during product retrieval.
-
product
final static Unit product(String vendorId, ProductListener callback)
Retrieve the product having vendorId.
- Parameters:
vendorId- the vendor id of the product to fetch.callback- callback listener to receive product information or handle errors.
-
plan
final PLYPlan plan(String vendorId)
Retrieve the plan having vendorId.
- Parameters:
vendorId- the vendor id of the plan to fetch.
-
plan
final static Unit plan(String vendorId, Function1<PLYPlan, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieve the plan having vendorId.
- Parameters:
vendorId- the vendor id of the plan to fetch.onSuccess- callback for successful plan retrieval.onError- callback for successful plan retrieval.
-
plan
final static Unit plan(String vendorId, PlanListener callback)
Retrieve the plan having vendorId.
- Parameters:
vendorId- the vendor id of the plan to fetch.callback- callback listener to receive plan information or handle errors.
-
plan
final PLYPlan plan(String sku, String basePlanId)
Retrieves a PLYPlan matching a given SKU and optionally a base plan ID.
This function searches through all available products and their associated plans to find a plan that matches the provided SKU (store product ID) and, if specified, shares the same base plan ID.
- Parameters:
sku- The SKU (store product ID) of the plan to search for.basePlanId- Optional: The ID of the base plan that the desired plan should belong to.
-
plan
final static Unit plan(String sku, String basePlanId, Function1<PLYPlan, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieves a Purchasely Plan associated with a specific product SKU.
This function asynchronously retrieves a Purchasely Plan based on the provided product SKU. You can optionally specify a
basePlanIdto further refine the search or leave it null to search across all plans. The result is delivered through either theonSuccesscallback with the found plan or theonErrorcallback with an error indicating the failure.- Parameters:
sku- The SKU (store product ID) of the plan to search for.basePlanId- An optional identifier for the base plan to narrow down the search.onSuccess- A callback function that will be invoked with the retrieved PLYPlan object if the plan is found.onError- A callback function that will be invoked if an error occurs during the plan retrieval process.
-
purchase
final static Unit purchase(Activity activity, PLYPlan plan, PLYPromoOffer offer, String contentId, Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)
Purchase a plan directly.
- Parameters:
activity- the android activity from which the purchase process is initiated.plan- the PLYPlan to be purchased.offer- the PLYPromoOffer for the purchase.contentId- the content id associated to the purchase.onSuccess- callback to handle successful purchase results.onError- callback to handle errors during the purchase process.
-
restoreAllProducts
final static Unit restoreAllProducts(Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)
Initiate restoration for all previous purchases.
- Parameters:
onSuccess- callback to handle successful restoration results.onError- callback to handle errors during the restoration process.
-
silentRestoreAllProducts
final static Unit silentRestoreAllProducts(Function1<PLYPlan, Unit> onSuccess, Function1<PLYError, Unit> onError)
Restore previous purchases.
- Parameters:
onSuccess- callback to handle successful restoration results.onError- callback to handle errors during the restoration process.
-
synchronize
final static Unit synchronize()
Synchronize purchases from your own in-app purchase system with Purchasely. Only useful in observer mode
-
displaySubscriptionCancellationInstruction
final static Unit displaySubscriptionCancellationInstruction(Activity activity, @StyleRes() Integer themeId)
Display a dialog informing the user how to cancel his subscription.
- Parameters:
activity- Activity instance.themeId- Resource identifier to set a custom style to dialog.
-
subscriptionsFragment
final static PLYPurchaseFragment subscriptionsFragment()
-
userSubscriptions
final static Unit userSubscriptions(Boolean invalidateCache, SubscriptionsListener callback)
Retrieve user's active subscriptions.
- Parameters:
callback- callback to receive active subscriptions or handle errors.
-
userSubscriptions
final static Unit userSubscriptions(Boolean invalidateCache, Function1<List<PLYSubscriptionData>, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieve user's active subscriptions information.
- Parameters:
onSuccess- callback to receive active subscriptions.onError- callback to handle errors during active subscriptions retrieval.
-
userSubscriptions
final List<PLYSubscriptionData> userSubscriptions(Boolean invalidateCache)
Retrieve user's active subscriptions.
-
userSubscriptionsHistory
final Unit userSubscriptionsHistory(Boolean invalidateCache, SubscriptionsListener callback)
Retrieve user's expired subscriptions.
- Parameters:
callback- a listener to receive the list of expired subscriptions or handle errors.
-
userSubscriptionsHistory
final Unit userSubscriptionsHistory(Boolean invalidateCache, Function1<List<PLYSubscriptionData>, Unit> onSuccess, Function1<Throwable, Unit> onError)
Retrieve user's expired subscriptions.
-
userSubscriptionsHistory
final List<PLYSubscriptionData> userSubscriptionsHistory(Boolean invalidateCache)
Retrieve user's expired subscriptions.
-
purchaseHistory
final List<PLYPlan> purchaseHistory()
Retrieve the purchase history.
-
isPastSubscriber
final Boolean isPastSubscriber()
Check whether the user is a past subscriber.
-
isDeeplinkHandled
final static Boolean isDeeplinkHandled(Uri deeplink, Activity activity)
Attempts to handle the provided deeplink, potentially by queuing it for processing.
The optional activity argument influences how the deeplink is opened:
If an Activity is provided (it will be stored as a
WeakReference): The SDK will use this Activity's context to launch the deeplink content. This typically keeps the new screen within the user's current application task, providing a more seamless navigation experience.If activity is
null: The SDK may launch the deeplink using the application context, which could result in the deeplink opening in a new task.
-
getBuiltInAttributes
final static Map<String, Object> getBuiltInAttributes()
Retrieve all built-in attributes.
-
getBuiltInAttribute
final static Object getBuiltInAttribute(String key)
Retrieve a built-in attribute by its key.
- Parameters:
key- the key of the built-in attribute to retrieve.
-
setAttribute
final static Unit setAttribute(Attribute attribute, String value)
-
setAttributes
final static Unit )>setAttributes(<ERROR CLASS><Attribute, String> attributes)
-
setPaywallActionsInterceptor
final static Unit setPaywallActionsInterceptor(Function4<PLYPresentationInfo, PLYPresentationAction, PLYPresentationActionParameters, Function1<Boolean, Unit>, Unit> handler)
-
setPaywallActionsInterceptor
final static Unit setPaywallActionsInterceptor(PLYPaywallActionListener handler)
-
setDefaultPresentationResultHandler
final static Unit setDefaultPresentationResultHandler(Function2<PLYProductViewResult, PLYPlan, Unit> handler)
-
userDidConsumeSubscriptionContent
final static Unit userDidConsumeSubscriptionContent()
-
retrieveLogs
final static List<String> retrieveLogs()
Retrieve recorded logs from the PurchaseLy SDK.
-
userAttribute
final static Object userAttribute(String key)
Retrieve the value of a user attribute.
- Parameters:
key- The key of the user attribute.
-
userAttributes
final static Map<String, Object> userAttributes()
Retrieve all user attributes.
-
setUserAttribute
final static Unit setUserAttribute(String key, String value)
Set a user attribute with a String value.
- Parameters:
key- the key of the user attribute.value- the String value to set.
-
setUserAttribute
final static Unit setUserAttribute(String key, Integer value)
Set a user attribute with an Int value.
- Parameters:
key- the key of the user attribute.value- the Int value to set.
-
setUserAttribute
final static Unit setUserAttribute(String key, Float value)
Set a user attribute with a Float value.
- Parameters:
key- the key of the user attribute.value- the Float value to set.
-
setUserAttribute
final static Unit setUserAttribute(String key, Boolean value)
Set a user attribute with a Boolean value.
- Parameters:
key- the key of the user attribute.value- the Boolean value to set.
-
setUserAttribute
final static Unit setUserAttribute(String key, Date value)
Set a user attribute with a Date value.
- Parameters:
key- the key of the user attribute.value- the Date value to set.
-
setUserAttribute
@RequiresApi(value = 26) final static Unit setUserAttribute(String key, Instant value)
Set a user attribute with an Instant value.
- Parameters:
key- the key of the user attribute.value- the Instant value to set.
-
setUserAttribute
final static Unit setUserAttribute(String key, Array<String> values)
-
setUserAttribute
final static Unit setUserAttribute(String key, Array<Integer> values)
-
setUserAttribute
final static Unit setUserAttribute(String key, Array<Float> values)
-
setUserAttribute
final static Unit setUserAttribute(String key, Array<Boolean> values)
-
setUserAttributes
final static Unit setUserAttributes(Map<String, Object> map)
Set multiple user attributes.
- Parameters:
map- a map containing key-value pairs of user attributes.
-
incrementUserAttribute
@JvmOverloads() final static Unit incrementUserAttribute(String key, Integer value)
Increment a user attribute with an optional Int value.
- Parameters:
key- the key of the user attribute.value- the increment (integer) to set, 1 by default
-
incrementUserAttribute
@JvmOverloads() final static Unit incrementUserAttribute(String key)
Increment a user attribute with an optional Int value.
- Parameters:
key- the key of the user attribute.
-
decrementUserAttribute
@JvmOverloads() final static Unit decrementUserAttribute(String key, Integer value)
Decrement a user attribute with an optional Int value.
- Parameters:
key- the key of the user attribute.value- the decrement (integer) to set, 1 by default
-
decrementUserAttribute
@JvmOverloads() final static Unit decrementUserAttribute(String key)
Decrement a user attribute with an optional Int value.
- Parameters:
key- the key of the user attribute.
-
clearUserAttributes
final static Unit clearUserAttributes()
Clear all user attributes.
-
clearUserAttribute
final static Unit clearUserAttribute(String key)
Clear a specific user attribute.
- Parameters:
key- the key of the user attribute to clear.
-
clearBuiltInAttributes
final Unit clearBuiltInAttributes()
Clear all built-in attributes.
-
setDynamicOffering
final Boolean setDynamicOffering(String reference, String planVendorId, String offerVendorId)
Add a dynamic offering to the Purchasely SDK.
- Parameters:
reference- The reference for the dynamic offering.planVendorId- The plan vendor id associated with the dynamic offering.offerVendorId- The plan's offer vendor id associated with the dynamic offering.
-
setDynamicOffering
final static Unit setDynamicOffering(String reference, String planVendorId, String offerVendorId, Function1<Boolean, Unit> callback)
Set a dynamic offering to the Purchasely SDK.
- Parameters:
reference- The reference for the dynamic offering.planVendorId- The plan id associated with the dynamic offering.offerVendorId- The plan's offer id associated with the dynamic offering.callback- Callback indicating the result of the operation.
-
getDynamicOfferings
final List<PLYDynamicOffering> getDynamicOfferings()
Retrieve all dynamic offerings stored in the Purchasely SDK.
-
getDynamicOfferings
final static Unit getDynamicOfferings(Function1<List<PLYDynamicOffering>, Unit> callback)
Retrieve all dynamic offerings stored in the Purchasely SDK.
- Parameters:
callback- Callback to receive the list of dynamic offerings.
-
removeDynamicOffering
final static Unit removeDynamicOffering(String reference)
Remove the dynamic offering with the specified reference from the Purchasely SDK.
-
clearDynamicOfferings
final static Unit clearDynamicOfferings()
Clear all dynamic offerings stored in the Purchasely SDK.
-
setThemeMode
final static Unit setThemeMode(PLYThemeMode mode)
Set the theme mode for the Purchasely SDK.
- Parameters:
mode- The desired PLYThemeMode for Purchasely SDK.
-
getThemeMode
final static PLYThemeMode getThemeMode()
Get the current theme mode for the Purchasely SDK.
-
getAnonymousUserId
final static <ERROR CLASS> getAnonymousUserId()
-
getNetworkTimeOut
final static Long getNetworkTimeOut()
The time amount to wait for network requests.
-
setNetworkTimeOut
final static Unit setNetworkTimeOut(Long networkTimeOut)
The time amount to wait for network requests.
-
getPlayerView
final static Object getPlayerView()
Your can provide your own video player It must implements PLYPlayerInterface
-
setPlayerView
final static Unit setPlayerView(Object playerView)
Your can provide your own video player It must implements PLYPlayerInterface
-
getLottieView
final static Function0<ImageView> getLottieView()
Your can provide your own lottie view It must implements PLYLottieInterface
-
setLottieView
final static Unit setLottieView(Function0<ImageView> lottieView)
Your can provide your own lottie view It must implements PLYLottieInterface
-
getEventListener
final static EventListener getEventListener()
Listener for purchase events.
-
setEventListener
final static Unit setEventListener(EventListener eventListener)
Listener for purchase events.
-
getUserAttributeListener
final static UserAttributeListener getUserAttributeListener()
Listener for user attributes.
-
setUserAttributeListener
final static Unit setUserAttributeListener(UserAttributeListener userAttributeListener)
Listener for user attributes.
-
getUiHandler
final static PLYUIHandler getUiHandler()
-
setUiHandler
final static Unit setUiHandler(PLYUIHandler uiHandler)
-
getPurchaseListener
final static PurchaseListener getPurchaseListener()
Listener for purchase events.
-
setPurchaseListener
final static Unit setPurchaseListener(PurchaseListener purchaseListener)
Listener for purchase events.
-
getLogLevel
final static LogLevel getLogLevel()
The log level used by the Purchasely SDK.
-
setLogLevel
final static Unit setLogLevel(LogLevel logLevel)
The log level used by the Purchasely SDK.
-
getRecordLogs
final static Boolean getRecordLogs()
Whether to record logs.
-
setRecordLogs
final static Unit setRecordLogs(Boolean recordLogs)
Whether to record logs.
-
getAppTechnology
final static PLYAppTechnology getAppTechnology()
The technology used by the Purchasely SDK.
-
setAppTechnology
final static Unit setAppTechnology(PLYAppTechnology appTechnology)
The technology used by the Purchasely SDK.
-
getSdkBridgeVersion
final static String getSdkBridgeVersion()
The version of the Purchasely SDK bridge (non-native).
-
setSdkBridgeVersion
final static Unit setSdkBridgeVersion(String sdkBridgeVersion)
The version of the Purchasely SDK bridge (non-native).
-
getSdkVersion
final static String getSdkVersion()
The version of the Purchasely SDK.
-
getReadyToOpenDeeplink
final static Boolean getReadyToOpenDeeplink()
Whether the SDK is ready to open deep links.
-
setReadyToOpenDeeplink
final static Unit setReadyToOpenDeeplink(Boolean readyToOpenDeeplink)
-
getRunningMode
final static PLYRunningMode getRunningMode()
The running mode of the Purchasely SDK.
-
setRunningMode
final static Unit setRunningMode(PLYRunningMode runningMode)
The running mode of the Purchasely SDK.
-
getLanguage
final static Locale getLanguage()
The language used by the Purchasely SDK.
-
setLanguage
final static Unit setLanguage(Locale language)
The language used by the Purchasely SDK.
-
-
-
-