Android BroadcastReceiver并不总是有效

时间:2014-09-22 07:28:59

标签: android broadcastreceiver

我有两个BroadcastReceivers,一个用于短信,一个用于网络状态。两者都运行良好但有时它们不会触发并要求我重新启动手机以便再次触发。这是我的清单

    <receiver
        android:name="com.beecell.aghanina.networkstate.NetworkChangeReceiver"
        android:label="NetworkChangeReceiver" >
        <intent-filter android:priority="905">
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        </intent-filter>
    </receiver>
    <receiver
        android:name="com.beecell.aghanina.sms.SMSReceiver"
        android:label="SMSReceiver" >
        <intent-filter android:priority="907">
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        </intent-filter>
    </receiver>

这是我的短信接收器

public class SMSReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        Bundle bundle = intent.getExtras();
        if (bundle == null)
            return;
        LogFile.write("seemless sms received" );
    }
}

我在那里错过了什么?

此外,我在互联网上发现了一些使用

的帖子
<action android:name="android.provider.Telephony.GSM_SMS_RECEIVED"/>

GSM_SMS_RECEIVEDSMS_RECEIVED之间有什么区别我应该同时提供这两项操作吗?

0 个答案:

没有答案