2011-02-07 96 views
3

我想不会在接收到这样的停止短信传播

public class SMSReceiver extends BroadcastReceiver { 
@Override 
    public void onReceive(Context context, Intent intent) { 
     abortBroadcast(); 
     setResultData(null); 
    } 
} 

AndroidManifest.xml中

<receiver android:name=".SMSReceiver" android:enabled="true" android:priority = "100" > 
      <intent-filter> 
      <action android:name="android.provider.Telephony.SMS_RECEIVED" /> 
      </intent-filter> 
     </receiver> 

传播的短信,但是这是行不通的。现在我一直在寻找修复方法。任何帮助,高度赞赏。

感谢

+0

你意味着更大的 “这似乎不是** **被工作”? – 2011-02-07 09:28:53

+0

opps ..更正,谢谢 – kakopappa 2011-02-07 09:45:47

回答

6

您需要设置android:priority属性上<intent-filter>,而不是<receiver>

e.g

<intent-filter android:priority="9999" > 

使用该属性只有当你真的需要强加在该广播接收特定的顺序 ,或想迫使Android版 喜欢一个活动过度等。该值必须是整数,例如 “100”。更高的数字具有更高的优先级。 (该命令只适用 到同步信息;它的异步消息被忽略。)

http://developer.android.com/guide/topics/manifest/intent-filter-element.html