为什么我没有收到BOOT?

时间:2013-10-30 17:02:38

标签: android

嗨这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examples.android.calendar"
android:installLocation="preferExternal"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />

<uses-feature
    android:name="android.hardware.touchscreen"
    android:required="false" />

<application
    android:name="org.openintents.filemanager.FileManagerApplication"
    android:icon="@drawable/appicon"
    android:label="@string/app_name" >
    <activity
        android:name="com.examples.android.calendar.CalendarView"
        android:theme="@style/Theme.Sherlock" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.DayView"
        android:theme="@style/Theme.Sherlock" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.NewEvent03" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Event04" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.EventEdit" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Popup" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Deadlinepopup02" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Deadlinepopup04" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.NewInterview10" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.InterviewEvent11" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.EditInterview" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.InterviewOutcome14" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Followup" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.interviewFollowup" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.NewEvent" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.EventList" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.NewReminderOrFollowup" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.JobList" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.NewGenericEvent" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.GenericEventEdit" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Reminder" >
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Login" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.examples.android.calendar.crisismate2.Dashboard" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.InterviewReminder12"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.InterviewReminder13"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.ReminderPopUp01"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.Welldone17"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.Ooops"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.examples.android.calendar.crisismate2.Appliedjob01"
        android:theme="@android:style/Theme.Dialog" >
    </activity>

    <receiver android:name="com.examples.android.calendar.crisismate2.OnBootReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <service android:name="com.examples.android.calendar.crisismate2.OnBootService" >
    </service>

    <meta-data
        android:name="com.a0soft.gphone.aTrackDog.testVersion"
        android:value="28" />
    <meta-data
        android:name="org.openintents.about"
        android:resource="@xml/about" />

    <activity
        android:name="org.openintents.filemanager.FileManagerActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:label="@string/app_name" >
        <meta-data
            android:name="android.app.default_searchable"
            android:value=".search.SearchableActivity" />
    </activity>
    <activity
        android:name="org.openintents.filemanager.bookmarks.BookmarkListActivity"
        android:label="@string/bookmarks" >
    </activity>
    <activity
        android:name="org.openintents.filemanager.PreferenceActivity"
        android:label="@string/settings" />

    <!-- Filters for the Save as feature -->
    <activity
        android:name="org.openintents.filemanager.SaveAsActivity"
        android:label="Save as" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.OPENABLE" />

            <data
                android:mimeType="*/*"
                android:scheme="content" />
        </intent-filter>
    </activity>

    <provider
        android:name="org.openintents.filemanager.bookmarks.BookmarksProvider"
        android:authorities="org.openintents.filemanager.bookmarks" >
    </provider>
    <provider
        android:name="org.openintents.filemanager.search.SearchResultsProvider"
        android:authorities="org.openintents.filemanager.search" >
    </provider>
    <provider
        android:name="org.openintents.filemanager.search.SearchSuggestionsProvider"
        android:authorities="org.openintents.filemanager.search.suggest" >
    </provider>
    <provider
        android:name="org.openintents.filemanager.FileManagerProvider"
        android:authorities="org.openintents.filemanager"
        android:exported="true" >
    </provider>

    <!-- Activities from OI Distribution Library -->
    <activity
        android:name="org.openintents.distribution.EulaActivity"
        android:theme="@android:style/Theme.DeviceDefault" />
    <activity
        android:name="org.openintents.distribution.NewVersionActivity"
        android:theme="@android:style/Theme.DeviceDefault" />
    <activity
        android:name=".search.SearchableActivity"
        android:launchMode="singleTop" >
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>

        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
    </activity>

    <provider
        android:name="org.openintents.filemanager.search.RecentsSuggestionsProvider"
        android:authorities="org.openintents.filemanager.search.SuggestionProvider" >
    </provider>

    <service android:name="org.openintents.filemanager.search.SearchService" >
    </service>

    <activity
        android:name="org.openintents.filemanager.IntentFilterActivity"
        android:configChanges="keyboardHidden|orientation|screenSize" >
        <intent-filter>
            <action android:name="org.openintents.action.PICK_FILE" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="file" />
            <data android:mimeType="*/*" />
        </intent-filter>
        <intent-filter>
            <action android:name="org.openintents.action.PICK_FILE" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="file" />
        </intent-filter>
        <intent-filter>
            <action android:name="org.openintents.action.PICK_FILE" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="org.openintents.action.PICK_DIRECTORY" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="file" />
        </intent-filter>
        <intent-filter>
            <action android:name="org.openintents.action.PICK_DIRECTORY" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />

            <data android:mimeType="*/*" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />

            <data android:scheme="file" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
        </intent-filter>

        <!-- Filter for multi select feature -->
        <intent-filter>
            <action android:name="org.openintents.action.MULTI_SELECT" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

</manifest>

这是我的接收者:

package com.examples.android.calendar.crisismate2;

import android.content.BroadcastReceiver;
import android.content.Context;

import android.content.Intent; import android.util.Log;

public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
    Log.e("OnBootReceiver", "Hi, Mom!");
    Intent i = new Intent(context, OnBootService.class);
    context.startService(i);
}
}

为什么我没有收到BOOT?

我没有看到Log“嗨,妈妈!”

感谢您的帮助!!!

1 个答案:

答案 0 :(得分:1)

删除android:installLocation="preferExternal",它会起作用。 Android会按照Android Developer website

中的说明在安装外部存储空间之前广播BOOT_COMPLETED
  

收听“启动完成”的广播接收器   在将外部存储装置到设备之前,系统会传送ACTION_BOOT_COMPLETED广播。如果您的应用程序安装在外部存储器上,则它永远不会接收此广播。