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 special_price defined.

    <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>

    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>
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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 context
        bundle - message data as String key/value pairs.
        Returns:

        a PendingIntent to be executed or null to keep the default behaviour from Marigold