0

我想知道是否可以创建一个通知(通常是高优先级),无论他们在做什么(例如在应用程序中,查看主屏幕等),都会在用户屏幕顶部弹出,使用户能够对通知采取行动。类似于 BB 的做法(见图)。我查看了他们的通知 API,但找不到任何这种性质的东西。

http://n4bb.com/wp-content/uploads/2013/07/bb10-quick-reply-1-620x400.jpg

4

3 回答 3

1

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.

于 2013-11-07T17:26:33.130 回答
0

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.

于 2013-11-07T18:35:08.717 回答
0

您可以为通知的​​外观定义自定义布局文件。通过这种方式,您可以更改大小、颜色以及添加一些灯光小部件。

最重要的是:它也在 android-API 中进行了解释!

理论/设计模式:http: //developer.android.com/design/patterns/notifications.html

实用/代码:http: //developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification

于 2013-11-07T17:28:46.280 回答