Calling :
public static void triggerTestNotification(Context ctx, String tag, int id) {
Notification not = new NotificationCompat.Builder(ctx)
.s
If you use a caching service like waybackmachine and you look for previous versions of the Notifications guide, you will see that the guide does tell you that the contentIntent
is required.
This is reflected in the Android source as well. NotificationManagerService
handles the checking of Notifications before displaying them.
In Gingerbread, as part of the enqueueNotificationInternal()
method, it has this check:
if (notification.icon != 0) {
if (notification.contentView == null) {
throw new IllegalArgumentException("contentView required: pkg=" + pkg
+ " id=" + id + " notification=" + notification);
}
if (notification.contentIntent == null) {
throw new IllegalArgumentException("contentIntent required: pkg=" + pkg
+ " id=" + id + " notification=" + notification);
}
}
On later Android versions, such as Ice Cream Sandwich, that check is gone:
if (notification.icon != 0) {
if (notification.contentView == null) {
throw new IllegalArgumentException("contentView required: pkg=" + pkg
+ " id=" + id + " notification=" + notification);
}
}
Thus, a contentIntent
is required on Gingerbread and below.