MBAudience class

This is the plugin class for MBurger that implements the audience functionality, you can use this to target content to specific users or groups of users, based on their in app behavior. Audience data are updated at every startup, and when the app enters foreground, using the WidgetsBindingObserver protocol when application state becomes AppLifecycleState.resumed

Inheritance

Constructors

MBAudience()
Defaults initializer, starts the plugin and method calls to native inteface

Properties

hashCode int
The hash code for this object.
no setterinherited
order int
The order of startup for this plugin, in MBurger
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startupOrder int
The order of startup of plugins
getter/setter pairinherited

Methods

locationDataUpdated(double latitude, double longitude) → void
inherited
messagesReceived(List messages, bool fromStartup) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startupBlock() Future<void>
The function run at startup by MBurger, initializes the plugin and do the startup work. It increments the session number and updates the metadata.
override
tagChanged(String tag, {String? value}) → void
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

currentSession Future<int>
Returns the current session tracked by MBAudience
no setter

Static Methods

getCustomId() Future<String?>
Retrieves the current saved custom id. @returns a Future that completes with the current saved custom id.
getMobileUserId() Future<int?>
Retrieves the current saved mobile user id. @returns a Future that completes with the current saved mobile user id.
removeCustomId() Future<void>
Removes the custom id saved and sync audience data to the server.
removeMobileUserId() Future<void>
Removes the mobile user id saved and sync audience data to the server.
removeTag(String tag) Future<void>
Removes the tag with the specified key and syncs audience data with the server. @param tag The key of the tag that needs to be removed.
removeTags(List<String> tags) Future<void>
Removes the tags with the specified keys and syncs audience data with the server. @param tags The keys of the tags that need to be removed.
setCurrentLocation(double latitude, double longitude) Future<void>
Updates current user location with the parameters passed and calls the api to update the device data. Note: a new location is sent to MBurger only if it's distant at least 100m from the last location seen. @param latitude Current latitude. @param longitude Current longitude.
setCustomId(String customId) Future<void>
Set a custom id that will be sent with the audience data, this can be used if you want to target users coming from different platforms from MBurger. After setting this id the new audience data are sent to the server. @param customId The custom id, this value is saved and will be sent until removeCustomId is called.
setMobileUserId(int mobileUserId) Future<void>
Set the mobile user id of the user currently logged in MBurger. After setting this id the new audience data are sent to the server.
setTag({required dynamic tag, required dynamic value}) Future<void>
Set the tag with a key and a value, if a tag with that key already exists its value is replaced by the new value. After setting the new tag the new audience data are sent to the server. @param tag The tag. @param value The value of the tag.
setTags({required Map<String, String> tags}) Future<void>
Set multiple tags with a Map, the keys of the map are the tags, the values the values for the corresponding tag. After setting the new tags the new audience data are sent to the server. @param tags The map of tags and values.
startLocationUpdates() Future<void>
Start collecting location data and to send it to the server. iOS: MBAudience uses startMonitoringSignificantLocationChanges of CoreLocation with an accuracy of kCLLocationAccuracyHundredMeters. To stop collecting location data call stopLocationUpdates. Android: MBAudience let you track and target user based on their location, the framework uses a foreground FusedLocationProviderClient with priority PRIORITY_BALANCED_POWER_ACCURACY which is killed the moment the app goes in background. If you wish to track user position while app is in background you need to implement your own location service, then when you have a new location you can use this API to send it to the framework: setCurrentLocation(latitude, longitude)
startSessionDateForSession(int session) Future<DateTime?>
The date of the last session
stopLocationUpdates() Future<void>
Stop collecting location data.