Reputation: 147
I was wondering if it was possible to create a notification (typically something high priority) that will popup at the top of the user's screen no matter what they are doing (e.g. in an app, looking at the homescreen, etc) enabling the user to act on the notification. Similar to the way BB does it (see image). I looked through their notification API's but I couldn't find anything of this nature.
http://n4bb.com/wp-content/uploads/2013/07/bb10-quick-reply-1-620x400.jpg
Upvotes: 0
Views: 2438
Reputation: 609
As a preface, you may want to heed other users' advice that this might be a bad idea from a UX perspective. But, if your notifications are just that awesome, read on.
There is a permission in Android called android.permission.SYSTEM_ALERT_WINDOW
that allows you to draw whatever you want whenever you want (as an aside: love it (I do) or hate it, this is not possible in iOS). This is how the Facebook app implements chat bubbles that stay on your screen while you're in other apps.
Once you've got the permission, this post shows some details as to how to use the WindowManager
to get the job done.
Upvotes: 0
Reputation: 2348
You can define custom-layout files for the look of your notifications. This way you can change the size, the color and also adding some light widgets aswell.
And best of it all: It is also explained in the android-API!
theoretical/design-pattern: http://developer.android.com/design/patterns/notifications.html
practical/code: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification
Upvotes: 0
Reputation: 3476
As CommonsWare
said, you're going to want to use the standard Android Notification System. Doing anything different than that is either going to annoy your users, or be blocked by the Operating System. Unless an app is in full screen mode, your notifications will pop up in the standard notification area.
Upvotes: 1