android – 广播接收器中接收呼叫的优先级

我的目的是制作一个广播接收器,在接收呼叫时执行动作.是否有可能比自动呼叫接收SO?更优先.

我已经尝试分配2147483647的优先级,我认为这是最好的,但仍然会跳到我接收器结束前尝试呼叫.

<!-- Receiver de llamadas -->
<receiver android:name=".PhoneCall">
    <intent-filter android:priority="2147483647">
        <action android:name="android.intent.action.PHONE_STATE"/>   
    </intent-filter>
</receiver>

解决方法:

这个链接回答我:

http://developer.android.com/reference/android/content/BroadcastReceiver.html

可以接收两种主要类型的广播:

  • normal broadcasts (sent with Context.sendbroadcast) are completely asynchronous. All receivers of the broadcast are run in an undefined
    order, often at the same time. This is more efficient, but means that
    receivers cannot use the result or abort APIs included here.

  • Ordered broadcasts (sent with Context.sendOrderedbroadcast) are delivered to one receiver at a time. As each receiver executes in
    turn, it can propagate a result to the next receiver, or it can
    completely abort the broadcast so that it won’t be passed to other
    receivers. The order receivers run in can be controlled with the
    android:priority attribute of the matching intent-filter; receivers
    with the same priority will be run in an arbitrary order.

像PHONE_STATE这样的广播是“普通广播”.据我所知,不可能优先考虑我的广播.有没有人想到任何方式?

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...