我在 Android 中的 BROADCAST 接收器有问题。所有接收器都运行良好,但无法正常运行 RECEIVED_BOOT_COMPLETED。有什么想法?
清单文件:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<receiver
android:name="telint.sms.appClass.SMSReceiver"
android:enabled="true" >
<intent-filter android:priority="2147483647" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.RECEIVE_BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
代码:
public class SMSReceiver extends BroadcastReceiver {
private static final String ACTION_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String ACTION_BOOT = "android.provider.Telephony.RECEIVE_BOOT_COMPLETED";
private static final String ACTION_INTERNET = "android.net.conn.CONNECTIVITY_CHANGE";
private static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION_BOOT)){
**//NOT WORKING HERE.**
}
}