0

In one of Activity-derived class methods I'm trying to send a Notification, clicking on which will bring the Activity to foreground if my app is in background (not visible) right now. There are reasons why I don't use Service, but use Activity (that will hold PARTIAL_WAKE_LOCK) for that.

I remember Notification worked for me when I used it like this, but I sent it from Service. Now when I send it from Activity method and it doesn't show up, though I hear its notification sound.

So are there any reasons that prevent Notification show up sent from Activity method and how can it be solved?

Thank you.

Community
  • 1
  • 1
rightaway717
  • 2,631
  • 3
  • 29
  • 43
  • Could it possibly be [Doze](http://developer.android.com/training/monitoring-device-state/doze-standby.html) related? – sonictt1 Mar 04 '16 at 16:36
  • You need to provide code in order for people to help. Have you added any logging? Is the system dropping your `Intent` for some reason? There's nothing inherent to notifications which prevent a one set by an activity from raising the activity. Is your activity receiving the intent but it is not being handled properly? – Larry Schiefer Mar 04 '16 at 16:53
  • Thank you for responding. I have not noticed the warning in logcat, I thought if it doesn't crash that I'm good :) – rightaway717 Mar 04 '16 at 16:58

1 Answers1

0

I was not exactly precise copying Notification code sample. I removed setSmallIcon() call from code as I was too lazy to add icons. As a result system was really dropping my Intent, saying that no icon is provided for it and it'll be a crash in future releases.

rightaway717
  • 2,631
  • 3
  • 29
  • 43