接收短信不通知 [英] SMS receive with no notification

查看:117
本文介绍了接收短信不通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望收到短信在我的应用程序,但我不希望我的Andr​​oid展现出关于该事件的通知。算法:

I want to receive a sms in my app, but I don't want my Android to show a notification about that event. Algorithm:

1)接收短信(这是确定)

1) Receive sms (it's ok)

2)如果这是一个短信特殊内容格式(我的应用程序) - 处理它与我的应用程序,并且不显示通知

2) If this is a sms with special content-format (for my app) - process it with my app and don't display a notification.

3)如果这是一个简单的信息 - 我不想处理它,所以通知必须显示

3) If this is a simple message - I don't want to process it, so a notification must be displayed.

我试图用一种有序的广播,但它并不能帮助。某处,我读了SMS_RECEIVE的广播没有有序的,但我看到一些应用程序,它可以接收短信不通知。

I tried to use an ordered broadcast, but it doesn't help. Somewhere I read that SMS_RECEIVE's broadcast is not ordered, but I saw some apps, which can receive SMS without notify.

有没有人能帮助我或者给我正确的方式来解决这个问题?

Does anyone can help me or show me the right way to solve this problem?

感谢。

UPD:调用abortBroadcast()的boradcast没有帮助

Upd.: calling abortBroadcast() in boradcast doesn't help

推荐答案

设置优先于你的意图过滤器 //在清单

set priority in your intent-filter // in manifest

<intent-filter android:priority="100">  /*your receiver get high priority*/

//广播接收器

// in broadcast receiver

 if (keyword_match)
      {
        // Stop it being passed to the main Messaging inbox
        abortBroadcast();
      }

这篇关于接收短信不通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆