发送 Android“通知”到一个单独的系统
基本上我试图在其他地方的通知栏中显示“通知”,或者类似的效果。*
注意 "
:我对捕捉和可能弄乱原始通知并不真正感兴趣,我只是想知道它是否在那里。围绕这个主题似乎还有更多问题,但主要是质量是“我想要这个”,而预期的答案是“你不能”。也许你(我们)可以想出另一种选择?
我已经想到了,但似乎有问题的是:
1: 捕获所有发送的通知
。我认为您无法扩展/覆盖/更改当前的notificationManager
。人们似乎认为这对于非邪恶的应用程序来说是不需要的。我不同意。但尽管如此,我不知道有什么方法可以实现这一点。另一种选择是向经理询问当前的“实时”通知,但我认为没有这样的方法。还有这些线程的结论:
2:捕获广播。这似乎更可行,尽管并非所有内容都有可用的广播。除了最后一点之外:这意味着我必须找出可用的广播,并对每个广播进行硬编码。 让用户添加自己的广播有多可行?他们如何知道他们最喜欢的节目是否发送(以及发送什么内容)?(我的意思是:添加他们自己的应用程序应该收听的节目,而不是添加广播本身显然)
这可能涉及诸如捕获特定时间段内所有内容的活动之类的内容,然后您确保让您的程序发送通知,希望它也发送类似广播之类的内容?一旦识别出广播,您就想对其采取行动,但我不知道您是否可以动态地改变您的行为。
3:完全不同的东西,让我发送为许多不同类型的信息(用户最终可以选择)发送到“外部”地方。
* 我正在尝试将所有通知发送到辅助位置(本例中为手表)。我可以为各种不同的情况(短信、电话、邮件、推特等)制作一些东西,但这意味着双带宽和 cpu(电池),每次我(或用户)想要添加另一种类型的消息时,我需要编写更多代码。
Basically I'm trying to get the "notifications" present in the notification bar somewhere else, or something similar in effect.*
Mind the "
: I'm not really interested in catching and possibly messing with the original notification, I just want to know that it is there. There seems to be more questions around this topic, but mostly the quality is "I WANT THIS" with an expected "YOU CAN'T" answer. Maybe you (we) can come up with another option?
Things I have come up with, but that seem problematic are:
1:
Catching all send notification
's. I don't think you can extend/override/change the current notificationManager
. People seem to think this is not needed for non-evil apps. I disagree. But nevertheless I don't know any method that can accomplish this. Another option would mean to ask the manager for the current 'live' notification, but there is no such method I believe. Also the conclusion of these threads:
- Global intents that are fired for all Android notifications
- Receive Android NotificationManager Notifications from Non-System Apps
- Is it possible for an app to replace the NotificationManager? (google groups)
2: Catching Broadcasts. This seems more doable, although not everything has a broadcast available. Apart from that last point: This would mean I would have to find out what broadcasts are available, and act on each one hard-coded. How feasable would it be to let users add their own broadcasts? And how would they know if (and what) their favorite program sends out? (I mean: add their own the app should listen to, not add a broadcast itself obviously)
This might involve something like an activity that catches everything for a certain period of time, and then you make sure you let your program send a notification, hoping it also sends something like a broadcast? Once a broadcast is identified, you want to act on that, but I don't know if you can change your behavior this dynamically.
3: Something completely different that will let me send as many different types of information (user choosable in the end) to an 'outside' place.
* I'm trying to send all notifications to a secondary location (a watch in this case). I can make something for all sorts of different situations (SMS, phone, mail, twitter etc), but this means double bandwith and cpu (battery), and everytime I (or a user) wants to add another type of message, I need to code more.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确,缺少修改固件。
也是正确的,缺少修改固件。
他们不会。
当然欢迎您:
创建一个或多个使用此类事件的最终用户应用程序(例如,路由到您的手表)
记录并宣传您的
Intent
结构,说服开发人员利用它,广播此类事件或使用此类广播Correct, short of modifying firmware.
Also correct, short of modifying firmware.
They wouldn't.
You are certainly welcome to:
Define your own broadcast
Intent
structure for a broadcast saying "hey, if anyone out there has some sort of extended notification thingy, here's one!"Create one or more end-user applications that consume such events (e.g., routing to your watch)
Document and evangelize your
Intent
structure, convincing developers to take advantage of it, either to broadcast such events or consume such broadcasts