Ok, now I see your points. It is really not so easy with backendless, I have created an internal ticket to simplify this. As work around you can create your own BackendlessPushService here is a doc how to do it https://github.com/Backendless/Android-SDK/blob/master/docs/push.md .
then you should override method onMessage in next way
public boolean onMessage( Context context, Intent intent )
{
CharSequence tickerText = intent.getStringExtra( PublishOptions.ANDROID_TICKER_TEXT_TAG );
CharSequence contentTitle = intent.getStringExtra( PublishOptions.ANDROID_CONTENT_TITLE_TAG );
CharSequence contentText = intent.getStringExtra( PublishOptions.ANDROID_CONTENT_TEXT_TAG );
if( tickerText != null && tickerText.length() > 0 )
{
int appIcon = context.getApplicationInfo().icon;
if( appIcon == 0 )
appIcon = android.R.drawable.sym_def_app_icon;
Intent notificationIntent = context.getPackageManager().getLaunchIntentForPackage( context.getApplicationInfo().packageName );
PendingIntent contentIntent = PendingIntent.getActivity( context, 0, notificationIntent, 0 );
Notification notification = new Notification.Builder( context )
.setSmallIcon( appIcon )
.setSound( <URI to your sound> ) <- provide your sound
.setTicker( tickerText )
.setContentTitle( contentTitle )
.setContentText( contentText )
.setContentIntent( contentIntent )
.setWhen( System.currentTimeMillis() )
.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
int customLayout = context.getResources().getIdentifier( "notification", "layout", context.getPackageName() );
int customLayoutTitle = context.getResources().getIdentifier( "title", "id", context.getPackageName() );
int customLayoutDescription = context.getResources().getIdentifier( "text", "id", context.getPackageName() );
int customLayoutImageContainer = context.getResources().getIdentifier( "image", "id", context.getPackageName() );
int customLayoutImage = context.getResources().getIdentifier( "push_icon", "drawable", context.getPackageName() );
if( customLayout > 0 && customLayoutTitle > 0 && customLayoutDescription > 0 && customLayoutImageContainer > 0 )
{
NotificationLookAndFeel lookAndFeel = new NotificationLookAndFeel();
lookAndFeel.extractColors( context );
RemoteViews contentView = new RemoteViews( context.getPackageName(), customLayout );
contentView.setTextViewText( customLayoutTitle, contentTitle );
contentView.setTextViewText( customLayoutDescription, contentText );
contentView.setTextColor( customLayoutTitle, lookAndFeel.getTextColor() );
contentView.setFloat( customLayoutTitle, "setTextSize", lookAndFeel.getTextSize() );
contentView.setTextColor( customLayoutDescription, lookAndFeel.getTextColor() );
contentView.setFloat( customLayoutDescription, "setTextSize", lookAndFeel.getTextSize() );
contentView.setImageViewResource( customLayoutImageContainer, customLayoutImage );
notification.contentView = contentView;
}
NotificationManager notificationManager = (NotificationManager) context.getSystemService( Context.NOTIFICATION_SERVICE );
notificationManager.notify( intent.getIntExtra( BackendlessBroadcastReceiver.EXTRA_MESSAGE_ID, 0 ), notification );
}
return false;
}
it is important to return false. because you will duplicate push notification