I\'m trying to display a simple notification when a C2DM message is received. Services provide to UI but still run on the main thread. I\'ve seen people claim you can create and
First, the exception is thrown because you create a notification which has no view object referenced to it (contentView attribute is set to null) . You have to call setLatestEventInfo before showing the notification.
Second, the constructor you're using is deprecated. Please use the class Notification.Builder for creating notifications. If you support Android < API level 11, you can use the class NotificationCompat.Builder from the support library.
Third, yes it is possible to create notifications from a running service.
You should read the Notification documentation. Content View is required if you don't called the setLatestEventInfo() method.