Reputation: 36404
So, I've an issue as such:
I've written a service that has the notification receiver and which also calls the function notify(). My problem is this, similar to twitter, on a successful update I want to notify the user that the update was posted. And, if the update wasn't then I want to notify the user that the update has failed. When the update is posted, and user clicks on the notification, he or she will be taken to one activity. If the update isn't posted, and the user clicks on the notification, then the user will be taken to another activity that might have the drafts. Notification text/image would also change depending upon if the post was done or not. As of now, I'm able to post just one single text and not able to call notify() function from anywhere else thus becoming a huge trouble in building this notification system. Any help would be nice.
Upvotes: 0
Views: 116
Reputation: 10353
Create notification ("Updating..."), keep it's tag
on success -> cancel the "updating" notification (using it's tag) and create a new notification ("success")
on failure -> cancel the "updating" notification (using it's tag) and create a new notification ("failure")
Each of these notifications should have different PendingIntents (with differnet ids) which perform a different action (e.g. open a different activity) when clicked.
Upvotes: 2