Messaging APIs - Setting Default Parameters
Mesibo sets various default parameters when you create a MesiboMessage
object. You can override those defaults by providing your own parameters which will be used as default, for example, message expiry, type, link preview, emojify, etc.
Setting Default Parameters
To set default parameters, you only need to create a MesiboMessage
object with parameters of your choice and then set it as default by calling MesiboMessage.setDefaults()
static method.
MesiboMessage defaults = new MesiboMessage();
defaults.expiry = 3600*24*30;
defaults.emojify = false;
MesiboMessage.setDefaults(defaults);
Once you set defaults, all future MesiboMessage
objects created by the following methods will have default parameters copied from the default you have set.
MesiboMessage message = profile.newMessage();
The defaults will apply to mesibo UI modules too as they use the same method to create message objects.
You can anytime change the default parameters and it will automatically apply to future objects. For example, if you like to geotag each message, implement a location listener and keep setting location parameters in defaults.
defaults.latitude = 37.4275;
defaults.longitude = 122.1697;
Manually Applying Defaults
If you are using any other methods to create MesiboMessage
object, you can still apply defaults by manually calling initDefaults()
msg.initDefaults();