Package com.marigold.sdk.interfaces
Interface ContentIntentBuilder
-
- All Implemented Interfaces:
public interface ContentIntentBuilder
Implement this interface to build a custom intent to be executed when the notification is tapped <br/><br/> Note: Direct to URI notifications using the <code>_u</code> parameter will never call {@link #build(Context, Bundle)}
<br/><br/>
Example of usage directing users to <code>SaleActivity</code> when a notification has the custom field
<pre> <code> public class SaleContentIntentBuilder implements ContentIntentBuilder { {@literal @}Nullable {@literal @}Override public PendingIntent build(context: Context, bundle: Bundle) { if(bundle.containsKey("special_price")) { val intent = Intent(context, SaleActivity.class); return PendingIntent.getActivity(context, 12345, intent, PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE); } // return null to keep the default behavior return null } } </code> </pre>special_price
defined.Add your implementation using {@link NotificationConfig#setContentIntentBuilder(ContentIntentBuilder)}
<pre> <code> ... val marigold = Marigold() Marigold.startEngine(getApplicationContext(), "your sdk key") val notificationConfig = NotificationConfig() notificationConfig.setContentIntentBuilder(SaleContentIntentBuilder()) marigold.setNotificationConfig(notificationConfig) ... </code> </pre>
-
-
Method Summary
Modifier and Type Method Description abstract PendingIntent
build(Context context, Bundle bundle)
This method is called to build the intent to be executed when the notification is tapped Please set your own ContentIntentBuilder using NotificationConfig.setContentIntentBuilder -
-
Method Detail
-
build
abstract PendingIntent build(Context context, Bundle bundle)
This method is called to build the intent to be executed when the notification is tapped Please set your own ContentIntentBuilder using NotificationConfig.setContentIntentBuilder
- Parameters:
context
- The application contextbundle
- message data as String key/value pairs.- Returns:
a PendingIntent to be executed or null to keep the default behaviour from Marigold
-
-
-
-