No puedo generar la notificación (en el área de notificación) desde IntentService
. Obtengo NullPointerException
mientras obtengo NotificationManager
. El problema es con Contexto.Notificación de IntentService - NullPointerException al obtener el Contexto
06-01 16:46:05.910: ERROR/AndroidRuntime(14745): Caused by: java.lang.NullPointerException
06-01 16:46:05.910: ERROR/AndroidRuntime(14745): at android.content.ContextWrapper.getSystemService(ContextWrapper.java:363)
06-01 16:46:05.910: ERROR/AndroidRuntime(14745): at com.Android.Main1.FileUploaderService.<init>(FileUploaderService.java:71)
La línea de código es:
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
He tratado getApplicationContext()
, getBaseContext()
, pero fue en vano.
¿Podría alguien decirme cuál es el problema aquí? ¿Cómo genero notificaciones de un IntentService?
Información adicional:
que también tienen un Service
en mi aplicación, y las notificaciones de no funcione correctamente. El IntentService
no lo inicia una Actividad; es iniciado por el Servicio.
Gracias por la sugerencia: eso parece haber solucionado el problema. Tengo otro problema ahora; He hecho la pregunta en http://stackoverflow.com/questions/6209631/android-bad-notification-posted-couldnt-expand-remoteviews-for-statusbarnot. ¿Podrías echar un vistazo? – Chaitanya