Reputation: 526
I want to put my ongoing event icon on status bar at 2nd position like Skype does on login.
Upvotes: 1
Views: 3682
Reputation: 1835
So i went googling for this answer, and i found this question on the amazing StackOverflow. While Notification.priority = Notification.PRIORITY_MIN
works for API 16 and higher, doing
Notification.when = 0
works wonderously for API < 16.
Upvotes: 1
Reputation: 4511
When setting-up the notification, just set the .when field to Integer.MIN or Integer.MAX to respectively have the notification on the far left or far right.
Icons are sorted by this field on all versions of Android up-to ICS included.
On JB (4.1), you need to set the notification priority to get it on the left or right:
notification.priority = PRIORITY_MIN for the right side notification.priority = PRIORITY_MAX for the left side
EDIT: On tablets, if you use Notification.FLAG_FOREGROUND_SERVICE or startForeground, the icon will be positioned to the right and everything I tried to move it to the left didn't work (Tested on ICS).
Upvotes: 0
Reputation: 7820
http://grail.cba.csuohio.edu/~matos/notes/cis-493/lecture-notes/Android-Chapter23-Notifications.pdf
is a great document!
Check out the example:
Produce a notification. Allow the user to click on the Notification Panel and execute appropriate activity to attend the message.
Sorry to just post links. But, this will also be helpful, I believe: Display status bar notification from service in android
Upvotes: 0
Reputation: 6382
As the Notification Manager manages the notifications, this is not possible. The only way to get to the first position would be to have a Service and call startForeground() - but if another service already has done the same, your notification would be on the second position.
Apart from that there is no other way of influencing the position. If you create your notification first, you are on the first place. If another app creates the notification first, you are second.
Upvotes: 1