Custom Push Builder (since v2.4.1)

The Appoxee SDK offers the following methods to display push notifications for Android devices with API Level 16 and above.

  1. The SDK shows a default push notification view

  2. The SDK Uses Android’s BigTextStyle or BigPictureStyle

  3. The SDK Uses a user­defined layout (full custom push notification)

When Using (2) or (3) , it is best practice to put it in a method and call it prior to calling the SDK initAsync method.

 

BigText Style

 

Option 1 ‐ without adding additional fields (e.g : custom BigContentTitle and/or SummaryText

Please add a call to the following API after calling new initAsync():

AppoxeeManager.setPushStyle(NotificationBuilder.PushStyle.BIG_TEXT_STYLE);


In order to set small (ticker) icon and big (notification) icon, please use the following methods:

AppoxeeManager.setSmallIconResourceId(newSmallIcon);

AppoxeeManager.setBigIconResourceId(bigIconBitmap));


newSmallIcon ­ from the R file (e.g R.drawable.newTickerIcon)

bigIconBitmap ­ a Bitmap type variable.


Option 2 use an additional fields : e.g. custom BigContentTitle and/or SummaryText
 

Please use the following after calling new initAsync():

BigTextStyleNotificationBuilder bigTextStyle = new BigTextStyleNotificationBuilder() ;

bigTextStyle.setBigContentTitle("Testing BigTextTitle");

bigTextStyle.setSummaryText("Testing BigText Summary Text");

AppoxeeManager.setBigTextStyle(bigTextStyle.createBigTextStyle() );


In order to set small (ticker) icon and big (notification) icon, please use the following methods:

AppoxeeManager.setSmallIconResourceId(newSmallIcon);

AppoxeeManager.setBigIconResourceId(bigIconBitmap));

newSmallIcon ­ from the R file (e.g R.drawable.newTickerIcon)

bigIconBitmap ­ a Bitmap type variable


You may also use the parameterized Constructor : 

public BigTextStyleNotificationBuilder(CharSequence bigContentTitle,CharSequence summaryText,int smallIconId,Bitmap bigIcon)

 

BigPicture Style


Option 1 ‐ without adding additional fields (e.g : custom BigContentTitle and/or SummaryText
Please add a call to the following API after calling new initAsync()::

AppoxeeManager.setPushStyle(NotificationBuilder.PushStyle.BIG_PICTURE_STYLE)

In order to set small (ticker) icon and big (notification) icon, please use the following methods:

AppoxeeManager.setSmallIconResourceId(newSmallIcon);

AppoxeeManager.setBigIconResourceId(bigIconBitmap));

newSmallIcon ­ from the R file (e.g R.drawable.newTickerIcon)

bigIconBitmap ­ a Bitmap type variable


Option 2 use an additional fields : e.g. custom BigContentTitle and/or SummaryText and/or an image (Bitmap) as the image in the push notification

Please use the following code after calling new initAsync():
Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.demo_image);

BigPictureStyleNotificationBuilder style = new BigPictureStyleNotificationBuilder();

style.setBigContentTitle("Testing BigPictureTitle");
style.setSummaryText("Test BigPicture Summary Text");
style.setBigPicture(bm);

style.setBigLargeIcon(bitmap);

AppoxeeManager.setBigPictureStyle(style.createBigPictureStyle());

In order to set small (ticker) icon and big (notification) icon, please use the following methods:

AppoxeeManager.setSmallIconResourceId(newSmallIcon);

AppoxeeManager.setBigIconResourceId(bigIconBitmap));

newSmallIcon ­ from the R file (e.g R.drawable.newTickerIcon)

bigIconBitmap ­ a Bitmap type variable


You may also use the parameterized Constructor : 

public BigPictureStyleNotificationBuilder(Bitmap bigLargeIcon, Bitmap bigPicture, CharSequence bigContentTitleCharSequence summaryText,int smallIconId)



Resetting Style to default

Please use the following code after new initAsync() was called :

AppoxeeManager.setPushStyle(NotificationBuilder.PushStyle.NONE);


Full Custom Notification Builder

Using this feature requires an XML Layout designed as the custom push layout, for example named here “example_custom_push”.

CustomNotificationBuilder customPushBuilder = new CustomNotificationBuilder();

//These 4 definitions must be set when using full custom notification

customPushBuilder.layout = R.layout.example_custom_push;

customPushBuilder.layoutMessageId = R.id.example_push_message;

customPushBuilder.layoutSubjectId = R.id.example_push_subject;

customPushBuilder.statusBarIconDrawableId = R.drawable.ic_launcher;

//These 2 definitions can be set when using full custom notification,not mandatory.

customPushBuilder.layoutIconDrawableId = R.drawable.ic_launcher;

customPushBuilder.layoutIconId = R.id.example_push_icon;

//Finally to set the custom notification in the AppoxeeManager

AppoxeeManager.setCustomPushBuilder(customPushBuilder);

Resetting Custom Notification Builder to default (Disabling it)

AppoxeeManager.setCustomPushBuilder(null);