I have an app that receives notifications with data in them. I can retreive that data fine when the notification is tapped or when the app is active and the notification is received, but it doesn't work when I open the app with an active notification. Is there some way to see every notification from the app that is currently visible in the status bar?
Android notification shouldn't disappear after clicking the notification when tapped on it. Only after clicked on "clearall" then it should be cleared. How can I implement in Android?
Android notification shouldn't disappear after clicking the notification when tapped on it. Only after clicked on "clearall" then it should be cleared.
How can I implement in Android?
I want to show unread messages count on my android app's launcher icon. It should be cleared only, once the user read all messages. I have tried setnumber method inside my firebase push notification service class. But it is not showing badge count. Then I used this library, https://github.com/leolin310148/ShortcutBadger . Now it is showing badge count. But the problem is,when user open the app or remove notifications this badge count will automatically disappear. How can I show badge count on launcher icon?
I'm developing an android app integrating GCM notification capabilities. everything works fine, means I receive the notification (sound + icon on the notification bar) but I would like to display automatically the notification preview on the screen to the end user (when the device is unlocked) for 1 or 2 seconds.
How can I do that ? is there a specific parameter in the notification to permit this preview ?
As soon as the notification is received, I would like to show it to the end user for 2 or 3 seconds and then remains in the notification bar:
Then, end user can see the notification and the content automatically (a bit intrusive but I just want to know if this is possible)
What you are looking for is called a Heads-up Notification and can only be done in 5.0+
I was using https://github.com/ParsePlatform/PushTutorial sample code for a while.
Current example behavior is
Push notification will be received, either the app is opened or closed.
Push notification is in the form of showing icon in status bar with sound.
I cannot find a way to specific notification icon image. Parse is using app icon as notification icon by default. By Android design guideline requires us to have different style and size for notification icon.
When the app is opened, and notification received. Clicking on the notification icon will cause 2nd instance of the same app is launched. That's mean, there will be 2 instances of same app. (Personally, I don't feel this is a correct behavior)
I was wondering
How can I only receive the push notification when app is opened, but not closed?
How can I show it in the form of modal dialog, instance of showing icon in status bar with sound?
I am not sure about the 4th point, it didn't work that way for me. It opened the same instance for me. I think you are using a different application identifier and have two different application with same name and icon, but different identifier.
Now, for your use case, I think Push notification is not the ideal solution. Depending on what and how frequent you need to show this, you may opt for a repeating pull from the server or if you still want to use Push Notification then subscribe/unsubscribe from a Push Notification Channel when the app is pulled to foreground or background.
ie, when the application is in foreground (onStart() / onResume()), subscribe to a channel:
PushService.subscribe(context, "foregroundPush", YourActivity.class);
and when the application is moving to background (onStop() / onResume() / onDestroy() ), unsubscribe from the same channel:
PushService.unsubscribe(context, "foregroundPush", YourActivity.class);
Whenever you need to send a push notification to the devices with your application in foreground, use the channel 'foregroundPush'