Notification only seems to work in one activity. NOTIFICATION_SERVICE
cannot be resolved to a variable error
I've created something to make notifications happen from my app, the
problem is it will only work in one activity. If I move it into another
activity I get an error that says NOTIFICATION_SERVICE cannot be resolved
to a variable i'm not sure why this is.
Code below:
final int NOTIF_ID = 1234;
NotificationManager notifManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.alarmwarning, "New
E-mail", System.currentTimeMillis());
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this,
SettingsScreen.class), 0);
note.setLatestEventInfo(this, "New E-mail", "You have one unread
message.", intent);
notifManager.notify(NOTIF_ID, note);
// notifManager.cancel(NOTIF_ID);
No comments:
Post a Comment