I have an Android library that has a Service
that creates a Notification
. From what I understand Notification
must have a contentIntent
(PendingIntent
) set or a runtime exception will be thrown.
The problem is that I want users to be able to use this Service
as is, or extend it, so that they can set the PendingIntent
themselves through a callback during the creation of the Notification
. However, if they choose not to do this, I need to set the PendingIntent
to something so that there is no exception. Is there any way to create a dummy PendingIntent
that just acts as a fill-in?
Here's an example of the code from the createNotification
method:
PendingIntent p;
if(getPendingIntentCallback != null) {
p = getPendingIntentCallback.getPendingIntent();
}
else {
p = ?;
}
notification.contentIntent = p;