Modifier and Type | Field and Description |
---|---|
protected UserDependencyManager |
mDependencyProvider |
protected IDeviceIdReader |
mDeviceIdReader |
protected IEventMessenger |
mExternalIEventMessenger |
protected boolean |
mIsInstanceStopped
Should only be true when the current instance has been stopped.
|
protected SerialExecutor |
mUserDependencyExecutor |
protected static IAppboyEndpointProvider |
sAppboyEndpointProvider |
protected static java.lang.Object |
sBrazeEndpointProviderLock |
protected static IBrazeNotificationFactory |
sCustomNotificationFactory |
protected static Braze |
sInstance |
protected static java.lang.Boolean |
sIsApiKeyPresent |
protected static boolean |
sMockNetworkRequestsAndDropEvents |
protected static boolean |
sOutboundNetworkRequestsOffline |
protected static SdkEnablementProvider |
sSdkEnablementProvider |
Modifier | Constructor and Description |
---|---|
protected |
Appboy(android.content.Context context) |
Modifier and Type | Method and Description |
---|---|
<T> void |
addSingleSynchronousSubscription(IEventSubscriber<T> subscriber,
java.lang.Class<T> eventClass)
Adds a new subscription for an external Braze SDK event.
|
void |
changeUser(java.lang.String userId)
When you first start using Braze on a device, the user is considered "anonymous".
|
void |
changeUser(java.lang.String userId,
java.lang.String sdkAuthSignature)
Identical to
IAppboy.changeUser(String) but provides an sdk
auth signature for the new user before any networking begins. |
static void |
clearAppboyEndpointProvider()
Clear the currently set
IAppboyEndpointProvider |
void |
closeSession(android.app.Activity activity)
Closes the current session.
|
static boolean |
configure(android.content.Context context,
BrazeConfig config)
Optional static method to set configuration values for the Appboy singleton, overriding whatever values are
present in the braze.xml.
|
Card |
deserializeContentCard(org.json.JSONObject contentCardJson)
Constructs a Content Card from its
Card.forJsonPut() output. |
Card |
deserializeContentCard(java.lang.String contentCardString)
Helper method for
IAppboy.deserializeContentCard(JSONObject) . |
IInAppMessage |
deserializeInAppMessageString(java.lang.String inAppMessageJsonString)
This function returns a deserialized in-app message from the message JSON string.
|
static void |
disableSdk(android.content.Context context)
Disables the Braze SDK.
|
static boolean |
enableMockAppboyNetworkRequestsAndDropEventsMode()
Testing utility method that enables mocking for all Braze SDK network requests, essentially turning the SDK "off".
|
static void |
enableSdk(android.content.Context context)
Enables the Braze SDK after an invocation of
disableSdk(Context) . |
static android.net.Uri |
getAppboyApiEndpoint(android.net.Uri appboyEndpoint)
If an
IAppboyEndpointProvider is configured, that provider's delegate is
used to generate the Uri for the Braze API endpoint. |
IAppboyImageLoader |
getAppboyImageLoader()
Deprecated.
|
java.lang.String |
getAppboyPushMessageRegistrationId()
Returns the FCM/ADM registration Id used to send the device push messages.
|
java.util.List<Card> |
getCachedContentCards()
Retrieves the offline/cached list of Content Cards from offline storage.
|
static java.lang.String |
getConfiguredApiKey(android.content.Context context)
A helper method to determine if the SDK is configured with an API key.
|
int |
getContentCardCount()
Retrieves information about Content Cards based on the currently cached data.
|
long |
getContentCardsLastUpdatedInSecondsFromEpoch()
Retrieves information about Content Cards based on the currently cached data.
|
int |
getContentCardUnviewedCount()
Retrieves information about Content Cards based on the currently cached data.
|
BrazeUser |
getCurrentUser()
Returns the user currently being tracked by Braze.
|
void |
getCurrentUser(IValueCallback<BrazeUser> completionCallback)
Returns the user currently being tracked by Braze.
|
static IAppboyNotificationFactory |
getCustomAppboyNotificationFactory()
Deprecated.
Please use
getCustomBrazeNotificationFactory() instead. Deprecated since 5/20/21 |
static IBrazeNotificationFactory |
getCustomBrazeNotificationFactory() |
java.lang.String |
getDeviceId()
Get the device ID - a randomly generated, app specific ID that is stored on the device.
|
IBrazeImageLoader |
getImageLoader()
Returns the
IBrazeImageLoader for the Braze instance. |
java.lang.String |
getInstallTrackingId()
Deprecated.
|
static Braze |
getInstance(android.content.Context context)
Static method that returns the Appboy singleton.
|
static boolean |
getOutboundNetworkRequestsOffline() |
java.lang.String |
getRegisteredPushToken() |
protected static SdkEnablementProvider |
getSdkEnablementProvider(android.content.Context context) |
void |
logContentCardsDisplayed()
Reports that Content Cards were displayed.
|
void |
logCustomEvent(java.lang.String eventName)
Reports a custom named event.
|
void |
logCustomEvent(java.lang.String eventNameInput,
AppboyProperties properties) |
void |
logCustomEvent(java.lang.String eventName,
BrazeProperties properties)
Reports a custom named event.
|
void |
logFeedCardClick(java.lang.String cardId) |
void |
logFeedCardImpression(java.lang.String cardId) |
void |
logFeedDisplayed()
Reports that the feed was displayed.
|
void |
logPurchase(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price)
In order to log a purchase, switch to
IAppboy.logPurchase(String, String, BigDecimal, int) . |
void |
logPurchase(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price,
AppboyProperties properties) |
void |
logPurchase(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price,
BrazeProperties properties)
In order to log a purchase, switch to
IAppboy.logPurchase(String, String, BigDecimal, int, BrazeProperties) . |
void |
logPurchase(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price,
int quantity)
In order to log a purchase, switch to
IAppboy.logPurchase(String, String, BigDecimal, int, BrazeProperties) . |
void |
logPurchase(java.lang.String productIdInput,
java.lang.String currencyCodeInput,
java.math.BigDecimal price,
int quantity,
AppboyProperties properties) |
void |
logPurchase(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price,
int quantity,
BrazeProperties properties)
Reports that the current user made an in app purchase.
|
void |
logPushNotificationActionClicked(java.lang.String campaignId,
java.lang.String actionId,
java.lang.String actionType)
Reports that the user clicked on a push notification action button.
|
void |
logPushNotificationOpened(android.content.Intent intent)
Reports that the user clicked on the push notification.
|
void |
logPushNotificationOpened(java.lang.String campaignId)
When possible,
IAppboy.logPushNotificationOpened(Intent) should be used instead. |
void |
logPushStoryPageClicked(java.lang.String campaignId,
java.lang.String pageId)
Reports that the user clicked on a push story page.
|
void |
openSession(android.app.Activity activity)
Opens a new session or resumes the previous session.
|
void |
registerAppboyPushMessages(java.lang.String registrationId)
Registers the device as eligible to receive push notifications from Braze.
|
void |
registerPushToken(java.lang.String pushToken)
Registers this device as eligible for receive push notifications
from Braze.
|
<T> void |
removeSingleSubscription(IEventSubscriber<T> subscriber,
java.lang.Class<T> eventClass)
Removes a single subscription associated with the given activity and event class.
|
void |
requestContentCardsRefresh(boolean fromCache)
Requests an immediate refresh of Content Cards.
|
void |
requestFeedRefresh()
Requests an immediate refresh of the news feed from the Braze server.
|
void |
requestFeedRefreshFromCache()
Requests a refresh of the news feed from offline storage.
|
void |
requestGeofences(double latitude,
double longitude)
Requests a refresh of Braze Geofences for the specified GPS coordinate.
|
void |
requestImmediateDataFlush()
Requests an immediate flush of any analytics data waiting to be sent to Appboy's servers.
|
void |
requestLocationInitialization()
Clients apps may call this method when location permissions are granted to request immediate
initialization of geofences as appropriate.
|
static void |
setAppboyEndpointProvider(IAppboyEndpointProvider appboyEndpointProvider)
Sets an
IAppboyEndpointProvider to be used to route Braze API traffic
Note that if a custom endpoint is specified using BrazeConfig.Builder#setCustomEndpoint(String)
or via braze.xml configuration, any IAppboyEndpointProvider previously set
using this method will be overridden when the Appboy singleton initializes. |
void |
setAppboyImageLoader(IAppboyImageLoader appboyImageLoader)
Deprecated.
|
protected void |
setAppboyManagerAndSyncPolicyOffline(boolean isOffline)
Sets the AppboyManager and sync policy to match the isOffline value.
|
static void |
setCustomAppboyNotificationFactory(IAppboyNotificationFactory customAppboyNotificationFactory)
Deprecated.
Please use
setCustomBrazeNotificationFactory(IBrazeNotificationFactory) instead. Deprecated since 5/20/21 |
static void |
setCustomBrazeNotificationFactory(IBrazeNotificationFactory customNotificationFactory)
Set a custom
IBrazeNotificationFactory to be used to modify or create Braze push notifications. |
void |
setGoogleAdvertisingId(java.lang.String googleAdvertisingId,
boolean limitAdTrackingEnabled)
Sets the Google Advertising ID and associated ad-tracking enabled field for this device.
|
void |
setImageLoader(IBrazeImageLoader brazeImageLoader)
Sets the
IBrazeImageLoader for the Braze instance. |
static void |
setOutboundNetworkRequestsOffline(boolean isOffline)
Pauses or resumes outbound network requests from the Braze SDK at any point during runtime.
|
void |
setSdkAuthenticationSignature(java.lang.String signature)
Sets the signature used for SDK authentication
for the currently identified user.
|
protected static boolean |
shouldAllowSingletonInitialization() |
void |
subscribeToContentCardsUpdates(IEventSubscriber<ContentCardsUpdatedEvent> subscriber)
Subscribes to Content Cards events.
|
void |
subscribeToFeedUpdates(IEventSubscriber<FeedUpdatedEvent> subscriber)
Subscribes to news feed events.
|
void |
subscribeToNetworkFailures(IEventSubscriber<BrazeNetworkFailureEvent> subscriber)
Subscribes to network failures that have occurred within the SDK.
|
void |
subscribeToNewInAppMessages(IEventSubscriber<InAppMessageEvent> subscriber)
Subscribes to in-app message events.
|
void |
subscribeToSdkAuthenticationFailures(IEventSubscriber<BrazeSdkAuthenticationErrorEvent> subscriber)
Subscribes to SDK Authentication failures.
|
void |
subscribeToSessionUpdates(IEventSubscriber<SessionStateChangedEvent> subscriber)
Subscribes to Session start and close events.
|
protected void |
waitForUserDependencyThread()
Waits until any queued tasks in the mUserDependencyExecutor are
finished.
|
static void |
wipeData(android.content.Context context)
Hard resets all data created by the Braze SDK from the internal storage directory.
|
protected static volatile Braze sInstance
protected IDeviceIdReader mDeviceIdReader
protected IEventMessenger mExternalIEventMessenger
protected final SerialExecutor mUserDependencyExecutor
protected volatile UserDependencyManager mDependencyProvider
protected volatile boolean mIsInstanceStopped
getInstance(Context)
.protected static final java.lang.Object sBrazeEndpointProviderLock
protected static volatile IAppboyEndpointProvider sAppboyEndpointProvider
protected static volatile IBrazeNotificationFactory sCustomNotificationFactory
protected static volatile boolean sMockNetworkRequestsAndDropEvents
protected static volatile boolean sOutboundNetworkRequestsOffline
protected static volatile SdkEnablementProvider sSdkEnablementProvider
protected static volatile java.lang.Boolean sIsApiKeyPresent
public static Braze getInstance(android.content.Context context)
context
- Current contextpublic void openSession(android.app.Activity activity)
IAppboy
IAppboy.openSession(Activity)
within the session timeout of a call
to IAppboy.closeSession(Activity)
will cause the previous session to be
resumed. This is done so that transitions from one Activity to another do not
create a new session each time.openSession
in interface IAppboy
activity
- The current Activity.public void closeSession(android.app.Activity activity)
IAppboy
IAppboy.openSession(Activity)
within the session timeout.closeSession
in interface IAppboy
activity
- The current Activity.public void logCustomEvent(java.lang.String eventName)
IAppboy
logCustomEvent
in interface IAppboy
eventName
- The String identifier for the event to track. Best practice is to track generic
events useful for segmenting, instead of specific user actions (i.e. track
watched_sports_video instead of watched_video_adrian_peterson_td_mnf).public void logCustomEvent(java.lang.String eventName, BrazeProperties properties)
IAppboy
logCustomEvent
in interface IAppboy
eventName
- The String identifier for the event to track. Best practice is to track generic
events useful for segmenting, instead of specific user actions (i.e. track
watched_sports_video instead of watched_video_adrian_peterson_td_mnf).properties
- An object containing key-value properties describing this event. Property names
are non-empty strings <= 255 characters, with no leading dollar signs.public void logCustomEvent(java.lang.String eventNameInput, AppboyProperties properties)
logCustomEvent
in interface IAppboy
for the preferred method to use.
public void logPurchase(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price)
IAppboy
IAppboy.logPurchase(String, String, BigDecimal, int)
. Using this
method will by default log a purchase with a quantity of one.logPurchase
in interface IAppboy
IAppboy.logPurchase(String, String, java.math.BigDecimal, int)
public void logPurchase(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price, AppboyProperties properties)
logPurchase
in interface IAppboy
for the preferred method to use.
public void logPurchase(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price, BrazeProperties properties)
IAppboy
IAppboy.logPurchase(String, String, BigDecimal, int, BrazeProperties)
.
Using this method will by default log a purchase with a quantity of one.logPurchase
in interface IAppboy
IAppboy.logPurchase(String, String, java.math.BigDecimal, int, BrazeProperties)
public void logPurchase(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price, int quantity)
IAppboy
IAppboy.logPurchase(String, String, BigDecimal, int, BrazeProperties)
.logPurchase
in interface IAppboy
IAppboy.logPurchase(String, String, java.math.BigDecimal, int, BrazeProperties)
public void logPurchase(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price, int quantity, BrazeProperties properties)
IAppboy
logPurchase
in interface IAppboy
productId
- The String identifier for the product purchased. Usually the Google Play SKU.currencyCode
- Currencies should be represented as an ISO 4217 currency code. Supported
currency symbols include: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN,
BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR,
BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK,
DOP, DZD, EEK, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GGP, GHS, GIP, GMD,
GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK,
JEP, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP,
LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MTL,
MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN,
PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
SGD, SHP, SLL, SOS, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY,
TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VND, VUV, WST, XAF, XAG, XAU,
XCD, XDR, XOF, XPD, XPF, XPT, YER, ZAR, ZMK, ZMW and ZWL.
Any other provided currency symbol will result in a logged warning and no other action taken by the SDK.
price
- The price paid. Base units depend on the currency. As an example, USD should be
reported as Dollars.Cents, whereas JPY should be reported as a whole number of Yen.
All provided BigDecimal values will have RoundingMode.HALF_UP rounding applied
such that a maximum of two digits exist after the decimal point. May be negative.quantity
- The quantity of items purchased expressed as a whole number. Must be greater
than zero.properties
- A map of key-value properties describing this purchase. Property names
are non-empty strings <= 255 characters, with no leading dollar signs.
Property values can be integers, floats, booleans, datetimes
(of the formats "%FT%T%z", "%Y-%m-%d %H:%M:%S", "%Y-%m-%d", "%m/%d/%Y"),
or strings <= 255 characters.
Note: The productId and currencyCode are trimmed of any whitespace characters before being
sent to Braze.
Note: Querying the Google Play store for SKU details may return the price of a in-app purchases
in micros. Therefore, a purchase of price 0.99USD will be returned as 9900000. To pass
this value to Braze, be sure to convert it to a BigDecimal before attempting to convert
it from micros to a decimal value in order to avoid integer division rounding errors.
BigDecimal priceInMicro = new BigDecimal(9900000L);
BigDecimal priceInDecimal = priceInMicro.divide(new BigDecimal(10e6));
public void logPurchase(java.lang.String productIdInput, java.lang.String currencyCodeInput, java.math.BigDecimal price, int quantity, AppboyProperties properties)
logPurchase
in interface IAppboy
for the preferred method to use.
public void logPushNotificationOpened(java.lang.String campaignId)
IAppboy
IAppboy.logPushNotificationOpened(Intent)
should be used instead. Note that
integrations shouldn't be calling this method directly.
Reports that the user clicked on the push notification.
logPushNotificationOpened
in interface IAppboy
campaignId
- The ID of the campaign that triggered the push notification. This can be found as
an extra in the push notification intent.public void logPushNotificationOpened(android.content.Intent intent)
IAppboy
logPushNotificationOpened
in interface IAppboy
intent
- The push notification intent.public void logPushNotificationActionClicked(java.lang.String campaignId, java.lang.String actionId, java.lang.String actionType)
IAppboy
logPushNotificationActionClicked
in interface IAppboy
campaignId
- The ID of the campaign that triggered the push notification. This can be found as
an extra in the push notification intent.actionId
- The ID of the action button that was clicked.actionType
- The action type from the intent's string extra under Constants.APPBOY_ACTION_TYPE_KEY
.public void logPushStoryPageClicked(java.lang.String campaignId, java.lang.String pageId)
IAppboy
logPushStoryPageClicked
in interface IAppboy
campaignId
- The ID of the campaign that triggered the push notification. This can be found as
an extra in the push notification intent.pageId
- The ID of the push story page that was clicked.public void logContentCardsDisplayed()
IAppboy
logContentCardsDisplayed
in interface IAppboy
public void logFeedDisplayed()
IAppboy
logFeedDisplayed
in interface IAppboy
public void requestFeedRefreshFromCache()
IAppboy
IAppboy.requestFeedRefresh()
.requestFeedRefreshFromCache
in interface IAppboy
public void requestFeedRefresh()
IAppboy
requestFeedRefresh
in interface IAppboy
public void requestContentCardsRefresh(boolean fromCache)
IAppboy
IAppboy.subscribeToContentCardsUpdates(IEventSubscriber)
requestContentCardsRefresh
in interface IAppboy
fromCache
- whether to request data from offline storage.public void requestImmediateDataFlush()
IAppboy
requestImmediateDataFlush
in interface IAppboy
public void subscribeToNewInAppMessages(IEventSubscriber<InAppMessageEvent> subscriber)
IAppboy
InAppMessageEvent
.
IAppboy.removeSingleSubscription(com.appboy.events.IEventSubscriber, Class)
.
subscribeToNewInAppMessages
in interface IAppboy
subscriber
- A callback that should be executed when the news feed is updated.public void subscribeToContentCardsUpdates(IEventSubscriber<ContentCardsUpdatedEvent> subscriber)
IAppboy
ContentCardsUpdatedEvent
.
IAppboy.removeSingleSubscription(com.appboy.events.IEventSubscriber, Class)
.
subscribeToContentCardsUpdates
in interface IAppboy
subscriber
- A callback that will be executed when Content Cards are updated.public void subscribeToFeedUpdates(IEventSubscriber<FeedUpdatedEvent> subscriber)
IAppboy
FeedUpdatedEvent
.
IAppboy.removeSingleSubscription(com.appboy.events.IEventSubscriber, Class)
.
subscribeToFeedUpdates
in interface IAppboy
subscriber
- A callback that should be executed when the news feed is updated.public void subscribeToSessionUpdates(IEventSubscriber<SessionStateChangedEvent> subscriber)
IAppboy
SessionStateChangedEvent
.
IAppboy.removeSingleSubscription(com.appboy.events.IEventSubscriber, Class)
.
subscribeToSessionUpdates
in interface IAppboy
subscriber
- A callback that will be executed when a session is created or sealed.public void subscribeToNetworkFailures(IEventSubscriber<BrazeNetworkFailureEvent> subscriber)
IAppboy
subscribeToNetworkFailures
in interface IAppboy
subscriber
- A callback that will be executed when a network failure event has occurred.public void subscribeToSdkAuthenticationFailures(IEventSubscriber<BrazeSdkAuthenticationErrorEvent> subscriber)
IAppboy
subscribeToSdkAuthenticationFailures
in interface IAppboy
subscriber
- A callback that will be executed when an SDK authentication failure has occurred.public <T> void addSingleSynchronousSubscription(IEventSubscriber<T> subscriber, java.lang.Class<T> eventClass)
IAppboy
addSingleSynchronousSubscription
in interface IAppboy
subscriber
- The subscriber callback to fire for the given event class.eventClass
- The subscribed event class.public <T> void removeSingleSubscription(IEventSubscriber<T> subscriber, java.lang.Class<T> eventClass)
IAppboy
removeSingleSubscription
in interface IAppboy
subscriber
- The callback which is currently subscribed.eventClass
- The Event class which this IEventSubscriber is subscribed to.public void changeUser(java.lang.String userId)
IAppboy
BrazeUser
can be retrieved at any time using IAppboy.getCurrentUser()
.changeUser
in interface IAppboy
userId
- An external user identifier. May not be longer than Constants.USER_ID_MAX_LENGTH_BYTES
.IAppboy.getCurrentUser()
public void changeUser(java.lang.String userId, java.lang.String sdkAuthSignature)
IAppboy
IAppboy.changeUser(String)
but provides an sdk
auth signature for the new user before any networking begins. Otherwise,
the existing auth signature will be used.changeUser
in interface IAppboy
IAppboy.changeUser(String)
public BrazeUser getCurrentUser()
IAppboy
BrazeUser
is available. Please use
IAppboy.getCurrentUser(IValueCallback)
for the asynchronous version of this method.getCurrentUser
in interface IAppboy
public void getCurrentUser(IValueCallback<BrazeUser> completionCallback)
IAppboy
IAppboy.getCurrentUser()
for the synchronous version of this method.getCurrentUser
in interface IAppboy
completionCallback
- that has IValueCallback.onSuccess(T)
called with a non-null BrazeUser
or IValueCallback.onError()
called otherwise.public void registerAppboyPushMessages(java.lang.String registrationId)
IAppboy
For FCM/ADM applications, this takes the FCM/ADM registration ID to send the device FCM/ADM messages. The registration ID is flushed immediately.
registerAppboyPushMessages
in interface IAppboy
registrationId
- The registration IDfor the updated usage of this method.
public void registerPushToken(java.lang.String pushToken)
IAppboy
registerPushToken
in interface IAppboy
pushToken
- The push notification registration token.public java.lang.String getAppboyPushMessageRegistrationId()
IAppboy
getAppboyPushMessageRegistrationId
in interface IAppboy
for the updated usage of this method.
public java.lang.String getRegisteredPushToken()
getRegisteredPushToken
in interface IAppboy
@Deprecated public java.lang.String getInstallTrackingId()
getInstallTrackingId
in interface IAppboy
@Deprecated public IAppboyImageLoader getAppboyImageLoader()
getAppboyImageLoader
in interface IAppboy
@Deprecated public void setAppboyImageLoader(IAppboyImageLoader appboyImageLoader)
setAppboyImageLoader
in interface IAppboy
public IBrazeImageLoader getImageLoader()
IAppboy
IBrazeImageLoader
for the Braze instance.getImageLoader
in interface IAppboy
public void setImageLoader(IBrazeImageLoader brazeImageLoader)
IAppboy
IBrazeImageLoader
for the Braze instance.
This IBrazeImageLoader
is used for all image relatedsetImageLoader
in interface IAppboy
brazeImageLoader
- The image loader to be set for the Braze instance. If null,
then the existing image loader is unchanged.public int getContentCardCount()
IAppboy
Note that this method is synchronous and will block the current running thread.
getContentCardCount
in interface IAppboy
IAppboy.requestContentCardsRefresh(boolean)
public int getContentCardUnviewedCount()
IAppboy
Note that this method is synchronous and will block the current running thread.
getContentCardUnviewedCount
in interface IAppboy
IAppboy.requestContentCardsRefresh(boolean)
public long getContentCardsLastUpdatedInSecondsFromEpoch()
IAppboy
Note that this method is synchronous and will block the current running thread.
getContentCardsLastUpdatedInSecondsFromEpoch
in interface IAppboy
IAppboy.requestContentCardsRefresh(boolean)
public java.util.List<Card> getCachedContentCards()
IAppboy
getCachedContentCards
in interface IAppboy
public Card deserializeContentCard(java.lang.String contentCardString)
IAppboy
IAppboy.deserializeContentCard(JSONObject)
.deserializeContentCard
in interface IAppboy
contentCardString
- The string content of a Content Card's
JSONObject
obtained via JSONObject.toString()
.public Card deserializeContentCard(org.json.JSONObject contentCardJson)
IAppboy
Card.forJsonPut()
output. Useful for caching Content Card
data and recreating them for your own purposes.
Card
. I.e. clicks and
impressions can be logged on the returned object.deserializeContentCard
in interface IAppboy
contentCardJson
- The JSONObject
representation of a Content Card
as obtained via Card.forJsonPut()
.public void logFeedCardImpression(java.lang.String cardId)
logFeedCardImpression
in interface IAppboy
cardId
- The ID of the feed card.Card.logImpression()
public void logFeedCardClick(java.lang.String cardId)
logFeedCardClick
in interface IAppboy
cardId
- The ID of the feed card.Card.logClick()
public IInAppMessage deserializeInAppMessageString(java.lang.String inAppMessageJsonString)
IAppboy
deserializeInAppMessageString
in interface IAppboy
inAppMessageJsonString
- The in-app message JSON stringpublic void requestGeofences(double latitude, double longitude)
IAppboy
requestGeofences
in interface IAppboy
latitude
- A valid GPS latitude in range (-90, 90)longitude
- A valid GPS longitude in range (-180, 180)BrazeConfig.Builder.setAutomaticGeofenceRequestsEnabled(boolean)
,
ValidationUtils.isValidLocation(double, double)
public void requestLocationInitialization()
IAppboy
requestLocationInitialization
in interface IAppboy
public void setGoogleAdvertisingId(java.lang.String googleAdvertisingId, boolean limitAdTrackingEnabled)
IAppboy
setGoogleAdvertisingId
in interface IAppboy
googleAdvertisingId
- The Google Advertising ID.limitAdTrackingEnabled
- Whether ad-tracking is enabled for the Google Advertising ID.public void setSdkAuthenticationSignature(java.lang.String signature)
IAppboy
setSdkAuthenticationSignature
in interface IAppboy
signature
- SDK Authentication signaturepublic java.lang.String getDeviceId()
changeUser(String)
calls.getDeviceId
in interface IAppboy
public static java.lang.String getConfiguredApiKey(android.content.Context context)
public static void setOutboundNetworkRequestsOffline(boolean isOffline)
isOffline
- If true, sets the SDK to offline and pauses all outbound network requests. If false,
all outbound network requests from the SDK are enabled.public static boolean getOutboundNetworkRequestsOffline()
setOutboundNetworkRequestsOffline(boolean)
public static void setAppboyEndpointProvider(IAppboyEndpointProvider appboyEndpointProvider)
IAppboyEndpointProvider
to be used to route Braze API traffic
Note that if a custom endpoint is specified using BrazeConfig.Builder#setCustomEndpoint(String)
or via braze.xml configuration, any IAppboyEndpointProvider
previously set
using this method will be overridden when the Appboy singleton initializes.appboyEndpointProvider
- The IAppboyEndpointProvider that will return the URI for routing Braze trafficpublic static void clearAppboyEndpointProvider()
IAppboyEndpointProvider
public static android.net.Uri getAppboyApiEndpoint(android.net.Uri appboyEndpoint)
IAppboyEndpointProvider
is configured, that provider's delegate is
used to generate the Uri for the Braze API endpoint. Otherwise, return the Uri given.appboyEndpoint
- A Uri for a Braze API endpoint@Deprecated public static void setCustomAppboyNotificationFactory(IAppboyNotificationFactory customAppboyNotificationFactory)
setCustomBrazeNotificationFactory(IBrazeNotificationFactory)
instead. Deprecated since 5/20/21@Deprecated public static IAppboyNotificationFactory getCustomAppboyNotificationFactory()
getCustomBrazeNotificationFactory()
instead. Deprecated since 5/20/21public static void setCustomBrazeNotificationFactory(IBrazeNotificationFactory customNotificationFactory)
IBrazeNotificationFactory
to be used to modify or create Braze push notifications.
To ensure that your custom notification factory is always set before a notification is received,
call this method in the Application#onCreate()
method of your Application
class.customNotificationFactory
- The IBrazeNotificationFactory
that will return the notification to be displayed.public static IBrazeNotificationFactory getCustomBrazeNotificationFactory()
IBrazeNotificationFactory
or null.public static boolean configure(android.content.Context context, BrazeConfig config)
context
- Application contextconfig
- A BrazeConfig
to override any values in the `braze.xml` configuration or from a
previously set config.public static boolean enableMockAppboyNetworkRequestsAndDropEventsMode()
public static void disableSdk(android.content.Context context)
enableSdk(Context)
is called.
Appboy
should not be used. A new instance of getInstance(Context)
should be obtained after this call.
enableSdk(Context)
.public static void enableSdk(android.content.Context context)
disableSdk(Context)
. Note that the Braze SDK is enabled by default.
public static void wipeData(android.content.Context context)
Appboy
instance will be unusable after this call. Subsequent calls
to getInstance(Context)
will be usable.protected void setAppboyManagerAndSyncPolicyOffline(boolean isOffline)
protected static SdkEnablementProvider getSdkEnablementProvider(android.content.Context context)
protected static boolean shouldAllowSingletonInitialization()
protected void waitForUserDependencyThread()