Basic customization
Default push behaviour
By default, the Ocamba receiver will show a notification on the device’s notification area when a content push is received. Tapping this notification will open the browser and track the open push conversion for you.
Custom notification click actions
- To change notification click actions add to Application class:
OcambaHoood.notification().customActionButtons();
- On Broadcast receiver on method ocambaNotificationClick create event:
@Override public void ocambaNotificationClick(String message, Context context) { deepLink(context); }
- You can do same thing to notification action buttons:
@Override public void ocambaNotificationClick(String message, Context context) { deepLink(context); }
Custom notification layout:
- Change notification icon: To change notification icon (from status bar) create inside drawable (res -> drawable) xml icon with name:
ocamba_nc_icon.xml
- Change notification color: To change notification elements color create inside colors (res -> values -> colors):
<color name="ocamba_nc_name_color">#006291</color> <color name="ocamba_nc_text_color">#006291</color> <color name=“ocamba_nc_title_color”>#DB0000</color>
- Change notification layout: To change notification layout add to Application class:
OcambaHoood.notification().customLayout();
And then on custom broadcast receiver on method ocambaNotificationReceived add:
RemoteViews collapsedLayout = new RemoteViews(context.getPackageName(), R.layout.test_story_layout_small); RemoteViews expandedLayout = new RemoteViews(context.getPackageName(), R.layout.test_story_layout_large); collapsedLayout.setTextViewText(R.id.story_title, message.getTitle()); collapsedLayout.setTextViewText(R.id.story_subtitle, message.getDescription()); expandedLayout.setTextViewText(R.id.story_title, message.getTitle()); expandedLayout.setTextViewText(R.id.story_subtitle, message.getDescription()); expandedLayout.setImageViewBitmap(R.id.story_big_icon, getIcon(context, message.getImage())); OcambaHoood.notification().createCustomNotification(collapsedLayout, expandedLayout, message);
- Change multimessage notification icons (indicator, arrows): To change multimessage notification indicator icon create inside drawable (res -> drawable) xml icon with name:
ocamba_multimessage_indicator.xml
To change multimessage notification arrows icon create inside drawable (res -> drawable) xml icon with name:
ocamba_multimessage_arrow_next.xml ocamba_multimessage_arrow_previous.xml
NOTE: you can change notification sound, vibration pattern, notification layout (choose one type), title color, description color, multimessage indicator and arrows also from our Ocamba platform.
NOTE: from android 12 notifications with custom content views will no longer use the full notification area. Instead, system applies a standard template. Previously, custom notifications were able to use the entire notification area and provide their own layouts and styles.