0

I'm trying to call a simple method (not an activity) from a button in a notification. The button may be either created using .addAction or perhaps using RemoteViews.

The notification is created within a Service.

I've tried reading similar questions Handling buttons inside android notifications and trying what was suggested there to no avail. Does anyone have a complete solution for creating such a notification? Does the fact that the notification is being created from a service rather than an activity cause any issues?

Thanks.

Community
  • 1
  • 1
Larry
  • 396
  • 4
  • 7
  • 1
    "I'm trying to call a simple method (not an activity) from a button in a notification" -- a `Notification`, whether using `RemoteViews` or other facilities, only executes a `PendingIntent`. With a `PendingIntent`, you can start an activity, start a service, or send a broadcast. You cannot "call a simple method". "and trying what was suggested there to no avail" -- that is a useless description of your symptoms. – CommonsWare Feb 07 '14 at 23:57
  • Agreed - the solution others proposed was to send a broadcast, and have a broadcast receiver which will do whatever it is I want to do. I tried these solutions but nothing happens - the broadcast receiver never gets the broadcast - so I assume it is not sent or not sent correctly. – Larry Feb 08 '14 at 00:47
  • And without being able to see any of your code, it is impossible for people to help you. – CommonsWare Feb 08 '14 at 12:35
  • I was trying to use a Broadcast intent but instead got it working with a Service. – Larry Feb 10 '14 at 01:16

0 Answers0