StartupReceiver::onReceive() NOT Called at Boot



I’ve tested the code in this chapter on an Android 4.3 device (a nexus 4), and I do see the onReceive() method called, and everything works as expected and explained in the chapter. So I believe I haven’t missed anything while following along in the book.

When I test the exact same project with an Android 4.0.4 device(a motorola xoom) I dont see the method getting called. Any ideas on how to go about debugging something like this?

Btw - really excellent book, thank you! I’ve enjoyed working through it.



Howdy. Thanks for the kind words about the book. Let’s see if we can figure out this issue.

First of all, you might want to post your AndroidManifest.xml file in reply here, so we can be sure everything is in just the right spot/format. Specifically:

  • the uses-permission for RECEIVE_BOOT_COMPLETED should be a direct child of the manifest element
  • the “name” attribute of the receiver element should be the fully-qualified package+class

You can test the boot completed intent without rebooting anything using adb to send the intent, as described here:

Hopefully this gets you on the path to a solution…


Thank you for the reply. It now works now on the 4.0.4 device, even with the original manifest (posted below). I am unsure what was/is going on. Here is what I tried:

  1. The adb shell method doesnt seem to trigger the log message (neither on the 4.3 device nor the 4.0.4). Not sure why, any ideas?
  2. In the manifest I changed android:name=".StartupReceiver" to android:name=“”. After this I started seeing the log message.
  3. I couldn’t really make sense of this, because the above change should be a no-op. So I reverted it, and it still works now. The only other thing I remember doing is that I uninstalled the PhotoGallery app after making the manifest change in step 2, and before doing “Run As…” from eclipse. Something during this process seems to have realigned the misaligned stars. I usually do not do the uninstall step.


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />
    <permission android:name=""
        android:protectionLevel="signature" />    
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="" />
        android:theme="@style/AppTheme" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.SEARCH" />
            <meta-data android:name=""
        <service android:name=".PollService" />
        <receiver android:name=".StartupReceiver">
                <action android:name="android.intent.action.BOOT_COMPLETED" />

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


The adb shell command returned the following:

$ adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED cat=[android.intent.category.HOME] }
Broadcast completed: result=0


Glad it’s working for you now.

For the adb shell command, you need to specify both the package and fully-qualified class name for that to work (to my knowledge). So it should be like this:


Ah, thanks. Somehow missed the fully-qualified classname. That did the trick.

Thanks again,