简体   繁体   English

如何在Android的通知栏上禁用短信通知图标?

[英]How to disable sms notification icon on notification bar in android?

I want to make an SMS theme. 我想做一个短信主题。 I built it but one issue is remaining. 我建立了它,但还有一个问题。 When I receive an SMS, the default SMS theme notification and my app's SMS notification are both called and show on the notification bar. 当我收到一条短信时,默认的短信主题通知和我的应用程序的短信通知都会被调用并显示在通知栏上。 I want to disable the default SMS notification. 我想禁用默认的短信通知。

How can I disable it. 如何禁用它。

I found some where that the following code prevents it. 我发现以下代码阻止了它。

abortBroadcast();

But this disables the SMS data not saved to default DB. 但这会禁用未保存到默认数据库的SMS数据。 In other words, I only want to remove notification icons--not to remove the sms. 换句话说,我只想删除通知图标,而不是删除短信。

AFAIK, this is not possible. AFAIK,这是不可能的。 It would be up to the user to turn off notifications from whatever SMS app they use. 用户可以根据自己使用的任何SMS应用程序关闭通知。 I have used the default, ChompSMS and HandcentSMS... 我使用了默认的ChompSMS和HandcentSMS ...

Both Chomp and Handcent tell you to go to the default app and turn off notifications in the settings there so you don't get duplicate notifications. Chomp和Handcent都告诉您转到默认应用程序,然后在此处的设置中关闭通知,这样您就不会收到重复的通知。

Even if you could programmatically turn off the notifications for the default app, you would have to find a way to turn off notifications for all 3rd party apps as well... 即使您可以通过编程方式关闭默认应用程序的通知,也必须找到一种方法来关闭所有第三方应用程序的通知...

maybe what you could do (untested) is to abortBroadcast(); 也许您可以做的(未测试的)是abortBroadcast();

then write the sms back into the content provider 然后将短信写回到内容提供商

kinda the same way this answer writes to the inbox 有点像这个答案写到收件箱的方式

content://sms/sent and content://sms/inbox content://sms/sentcontent://sms/inbox

although content providers for sms are undocumented and unreliable across devices. 尽管短信的内容提供者在所有设备上都没有记录且不可靠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM