Class Marigold
- 
                    
                    
- All Implemented Interfaces:
 
public final class MarigoldKeeps track of necessary environment variables provided by the developer or google. Also provides the entry point into Marigold for the developer to retrieve device information.
 
- 
                
                    
                    
- 
                                
                            
                                
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMarigold.MarigoldHandlerGeneric handler for async calls to the Marigold SDK.
 
- 
                                
                            
                                
Field Summary
Fields Modifier and Type Field Description public final static StringACTION_NOTIFICATION_TAPPEDpublic final static StringACTION_NOTIFICATION_ACTION_TAPPEDpublic final static IntegerDEFAULT_NOTIFICATION_PERMISSION_REQUEST_CODE 
- 
                                
                            
                                
Constructor Summary
Constructors Constructor Description Marigold() 
- 
                                
                            
                                
Method Summary
Modifier and Type Method Description final UnitsetNotificationConfig(NotificationConfig notificationConfig)Sets the configuration of notifications built by Marigold. final UnitaddNotificationReceivedListener(NotificationReceivedListener listener)Adds listener to be called when a notification is received. final UnitaddNotificationTappedListener(NotificationTappedListener listener)Adds listener to be called when a notification is tapped. final UnitaddNotificationActionTappedListener(NotificationActionTappedListener listener)Adds listener to be called when a notification action is tapped. final UnitsetInAppNotificationsEnabled(Boolean enabled)Enables or disables the display of In-App Notifications. final UnitstartEngine(Context context, String appKey)Initialises The Marigold Mobile SDK. final UnitupdateLocation(Location location)Updates Marigold with this device's location. final UnitsetGeoIpTrackingEnabled(Boolean enabledGeoIp, Marigold.MarigoldHandler<Void> handler)Enabled location tracking based on IP Address. final UnitsetGeoIpTrackingEnabled(Boolean enabledGeoIp)Enabled location tracking based on IP Address. final UnitsetGeoIpTrackingDefault(Boolean enabledGeoIp)Set whether location tracking based on IP Address will be enabled or disabled by default when a device is created. final UnitlogRegistrationEvent(String userId)Log a registration event with Marigold. final UnitgetDeviceId(Marigold.MarigoldHandler<String> handler)Gets this devices ID on the Marigold Mobile Platform. final UnitsetLogger(Logger logger)All logging within Marigold Mobile is routed through this Logger. final UnitsetDeviceToken(String token)Pass the FCM token into the Marigold Mobile SDK. final UnithandleNotification(RemoteMessage remoteMessage)Pass received notification to Marigold Mobile SDK. final UnitsyncNotificationSettings()Checks the notifications enabled setting for the app and updates the device on the Marigold Mobile platform if required. final NotificationPermissionRequestResultrequestNotificationPermission(Activity activity, Boolean isRationaleActivity, Integer requestCode)Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. final NotificationPermissionRequestResultrequestNotificationPermission(Activity activity, Boolean isRationaleActivity)Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. final NotificationPermissionRequestResultrequestNotificationPermission(Activity activity)Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. - 
                    
                    
                    
- 
                                
                            
                                
Method Detail
- 
                                        
setNotificationConfig
final Unit setNotificationConfig(NotificationConfig notificationConfig)
Sets the configuration of notifications built by Marigold.
- Parameters:
 notificationConfig- The notification configuration to use
 
- 
                                        
addNotificationReceivedListener
final Unit addNotificationReceivedListener(NotificationReceivedListener listener)
Adds listener to be called when a notification is received. This method should be called after startEngine
- Parameters:
 listener- your implementation of NotificationReceivedListener
 
- 
                                        
addNotificationTappedListener
final Unit addNotificationTappedListener(NotificationTappedListener listener)
Adds listener to be called when a notification is tapped. This method should be called after startEngine
- Parameters:
 listener- your implementation of NotificationTappedListener
 
- 
                                        
addNotificationActionTappedListener
final Unit addNotificationActionTappedListener(NotificationActionTappedListener listener)
Adds listener to be called when a notification action is tapped. This method should be called after startEngine
- Parameters:
 listener- your implementation of NotificationActionTappedListener
 
- 
                                        
setInAppNotificationsEnabled
final Unit setInAppNotificationsEnabled(Boolean enabled)
Enables or disables the display of In-App Notifications. Must be called before startEngine. In-App Notifications are enabled by default.
- Parameters:
 enabled-falseto disable In-App Notifications andtrueto re-enable.
 
- 
                                        
startEngine
final Unit startEngine(Context context, String appKey)
Initialises The Marigold Mobile SDK. See documentation Connecting to Marigold Mobile for usage.
- Parameters:
 context- Application ContextappKey- The App Key of your application on the Marigold Mobile platform.
 
- 
                                        
updateLocation
final Unit updateLocation(Location location)
Updates Marigold with this device's location.
- Parameters:
 location- new location update
 
- 
                                        
setGeoIpTrackingEnabled
@JvmOverloads() final Unit setGeoIpTrackingEnabled(Boolean enabledGeoIp, Marigold.MarigoldHandler<Void> handler)
Enabled location tracking based on IP Address. Tracking location tracking is enabled by default. Use this method for users who may not want to have their location tracked at all.
- Parameters:
 enabledGeoIp- A boolean value indicating whether or not to disable location based on IP Address.handler- Handler for the result of enabling/disabling geo IP tracking.
 
- 
                                        
setGeoIpTrackingEnabled
@JvmOverloads() final Unit setGeoIpTrackingEnabled(Boolean enabledGeoIp)
Enabled location tracking based on IP Address. Tracking location tracking is enabled by default. Use this method for users who may not want to have their location tracked at all.
- Parameters:
 enabledGeoIp- A boolean value indicating whether or not to disable location based on IP Address.
 
- 
                                        
setGeoIpTrackingDefault
final Unit setGeoIpTrackingDefault(Boolean enabledGeoIp)
Set whether location tracking based on IP Address will be enabled or disabled by default when a device is created. This method must be called before startEngine.
- Parameters:
 enabledGeoIp- A boolean value indicating whether or not location based on IP Address should be enabled by default.
 
- 
                                        
logRegistrationEvent
final Unit logRegistrationEvent(String userId)
Log a registration event with Marigold. This is used to log users signing in and out of the app. Pass the ID you wish to use for the sign-in or null for a sign-out.
- Parameters:
 userId- The ID of the user signing in, or null for sign-out.
 
- 
                                        
getDeviceId
final Unit getDeviceId(Marigold.MarigoldHandler<String> handler)
Gets this devices ID on the Marigold Mobile Platform.
- Parameters:
 handler- Callback returns this devices ID
 
- 
                                        
setLogger
final Unit setLogger(Logger logger)
All logging within Marigold Mobile is routed through this Logger.
- Parameters:
 logger- a custom logger implementation.
 
- 
                                        
setDeviceToken
final Unit setDeviceToken(String token)
Pass the FCM token into the Marigold Mobile SDK. NOTE: This method should only be called if the app implements its own FirebaseMessagingService instance, in which case it must be called in order to provide the FCM token to the Marigold Mobile Platform. Otherwise this will be handled automatically by the Marigold Mobile SDK.
- Parameters:
 token- FCM token provided by FirebaseMessagingService
 
- 
                                        
handleNotification
final Unit handleNotification(RemoteMessage remoteMessage)
Pass received notification to Marigold Mobile SDK. NOTE: This method should only be called if the app implements its own FirebaseMessagingService instance, in which case it must be called in order to provide FCM notifications to the Marigold Mobile SDK for processing. Otherwise this will be handled automatically by the Marigold Mobile SDK.
- Parameters:
 remoteMessage- FCM notification
 
- 
                                        
syncNotificationSettings
final Unit syncNotificationSettings()
Checks the notifications enabled setting for the app and updates the device on the Marigold Mobile platform if required. From Android 13(T)+ it is recommended that this be called in when the result of the android.Manifest.permission.POST_NOTIFICATIONS permission is received to ensure the platform has the correct setting.
 
- 
                                        
requestNotificationPermission
@JvmOverloads() final NotificationPermissionRequestResult requestNotificationPermission(Activity activity, Boolean isRationaleActivity, Integer requestCode)
Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. This is a no-op on earlier Android versions and will return NotificationPermissionRequestResult.PERMISSION_NOT_REQUIRED.
- Parameters:
 activity- The activity to use to make the permissions request.isRationaleActivity- Boolean representing whether the activity provides details to the user justifying the need for the notifications permission.requestCode- The request code used to track the permissions request.
 
- 
                                        
requestNotificationPermission
@JvmOverloads() final NotificationPermissionRequestResult requestNotificationPermission(Activity activity, Boolean isRationaleActivity)
Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. This is a no-op on earlier Android versions and will return NotificationPermissionRequestResult.PERMISSION_NOT_REQUIRED.
- Parameters:
 activity- The activity to use to make the permissions request.isRationaleActivity- Boolean representing whether the activity provides details to the user justifying the need for the notifications permission.
 
- 
                                        
requestNotificationPermission
@JvmOverloads() final NotificationPermissionRequestResult requestNotificationPermission(Activity activity)
Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. This is a no-op on earlier Android versions and will return NotificationPermissionRequestResult.PERMISSION_NOT_REQUIRED.
- Parameters:
 activity- The activity to use to make the permissions request.
 
 - 
                                        
 
 - 
                                
                            
                                
 
 - 
                    
                    
                    
 
 -