Changing from a standard notification with text and a picture to more complex types with custom designed layout requires the use of RemoteViews class. And instead of using the setContentTitle(), I used setContent(remoteviews) method because of the custom view.
After changing to custom view I deleted the setContent, setSmallIcon, and setContentTitle mehods, however after I did that the notification never showed up again.
If I am using a custom view all I have to use us the setContent() method is that correct? they why does it not work with I remove the other methods?
RemoteViews remoteviews = new RemoteViews("com.test.example", R.layout.custom_notifications);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(AudioService.this)
.setContent(remoteviews)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("My notification")
.setContentText("Hello World!")
.setOngoing(true);
Well since ICS I have not really touched the Notification Builder. Even to this day I still do it the old school way when GB was more popular. Example time:
This should work for every release of android. Simply because
Notification.Builderis a wrapper to make it easier to create status bar notifications. Also the builder calls these methods if you look at androids source code.