为什么我的广播接收器被跳过而未送达?

时间:2017-07-12 12:58:35

标签: android broadcastreceiver

你好我有一个带有android.intent.action.PHONE_STATE动作的BrodcastReceiver,我试着调用模拟器。但我的接收器不起作用(所有需要的权限授予)。在dumpsys结果中有" Skipped"。

有人可以解释为什么跳过,为什么不送?

adb shell dumpsys activity broadcasts的结果:

Historical Broadcast background #17:
    BroadcastRecord{a158f22 u-1 android.intent.action.PHONE_STATE} to user -1
    Intent { act=android.intent.action.PHONE_STATE flg=0x10 (has extras) }
      extras: Bundle[{incoming_number=+71111111111, state=RINGING}]
    caller=android 1607:system/1000 pid=1607 uid=1000
    requiredPermissions=[android.permission.READ_PHONE_STATE]  appOp=51
    enqueueClockTime=2017-07-12 02:16:54 dispatchClockTime=2017-07-12 02:16:54
    dispatchTime=-9s627ms (+2ms since enq) finishTime=-8s306ms (+1s321ms since disp)
    resultTo=null resultCode=0 resultData=null
    nextReceiver=5 receiver=null
    Skipped #0: (manifest)
      priority=999 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
      ActivityInfo:
        name=com.example.dev.receivers.CallReceiver
        packageName=com.example.dev
        enabled=true exported=true directBootAware=false
        resizeMode=RESIZE_MODE_RESIZEABLE
    Deliver #1: (manifest)
      priority=999 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
      ActivityInfo:
        name=com.example.foo.receivers.CallReceiver
        packageName=com.example.foo
        enabled=true exported=true directBootAware=false
        resizeMode=RESIZE_MODE_RESIZEABLE
    Skipped #2: (manifest)
      priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
      ActivityInfo:
        name=com.google.android.apps.hangouts.telephony.TelePhoneStateReceiver
        packageName=com.google.android.talk
        enabled=true exported=true directBootAware=false
        resizeMode=RESIZE_MODE_RESIZEABLE

授予所有权限:

All permissions granted

我的接收者:

<receiver
    android:name=".receivers.CallReceiver"
    android:enabled="true"
    android:exported="true">

    <intent-filter android:priority="999">
        <action android:name="android.intent.action.PHONE_STATE" />
    </intent-filter>
    <intent-filter android:priority="999">
        <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
    </intent-filter>
</receiver>

0 个答案:

没有答案