-1

I am having a broadcast receiver that starts a service in ICS. I have not activity associated with the code. The issue that I am facing is that I am unable to receive the BOOT COMPLETED broadcast in my receiver. Is there a round about solution for this. To receive a boot complete intent in ICS. I read that http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html

but what is the soultion. Can anyone help in this.

Kara
  • 6,115
  • 16
  • 50
  • 57
user1106888
  • 245
  • 3
  • 14
  • Show us the AndroidManifest.xml, and a brief code snippet of what you're trying to do? :) – t0mm13b Oct 01 '12 at 20:26
  • Check out these posts from SO. [http://stackoverflow.com/questions/2784441/trying-to-start-a-service-on-boot-on-android][1] http://stackoverflow.com/questions/8950854/auto-start-application-after-boot-completed-in-android [1]: http://stackoverflow.com/questions/2784441/trying-to-start-a-service-on-boot-on-android – midhunhk Oct 01 '12 at 21:05

2 Answers2

0

enter code here

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">
    <receiver
         android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
         android:name=".BootComp"
         android:exported="true"
         android:enabled="true">

        <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>
  </receiver>


    <service android:name="CheckForUpdateService"></service>
    <activity android:name="Upgrade_choice"></activity>
</application>

This is my manifest file

user1106888
  • 245
  • 3
  • 14
  • This should really be in your question... why is there a receiver intent, with the intent's action as `LAUNCHER` in place? What are you getting in the logcat? – t0mm13b Oct 01 '12 at 21:59
  • ok that can be removed.My question is -- how to make sure that my receiver in the application receives the Boot complete intent. When the device is powered on. The log cat does not show error it is installing the apk. – user1106888 Oct 01 '12 at 22:02
  • Use `Log.d` method in your broadcast receiver to prove that your intent is being received, it will show up in the logcat. – t0mm13b Oct 01 '12 at 22:32
  • yes i am using the logcat that display the message when the intent is received but nothing is displayed in the Log since the receiver is not getting any intent action for boot complete – user1106888 Oct 01 '12 at 22:36
  • Take out the `LAUNCHER` category in your receiver for the `BOOT_COMPLETED` acton and see what happens? – t0mm13b Oct 01 '12 at 22:53
  • does not make any difference. – user1106888 Oct 01 '12 at 23:07
  • Really, I think you should enclose more information, as this is turning into a guesswork here, I cannot see your code, nor can I see your logcat nor screen either.... – t0mm13b Oct 01 '12 at 23:13
  • There is nothing in my Log cat i dont see any errors. Just my boor complete receiver not responding to Boot complete system broadcast. – user1106888 Oct 11 '12 at 20:11
0

This is my method in the receiver to receive the boot completed. I am starting a service on boot complete of the system.

if(("android.intent.action.BOOT_COMPLETED").equals(intent.getAction())) {

    Log.d(tag,"Received the BOOT COMPLETE intent");
    Intent i=new Intent();

    i.setAction("com.example.bootcompletecheck.CheckForUpdateService");

    ctx.startService(i);
    }
    else
    {
        Log.d(tag,"----Not received----");
    }
}

}

user1106888
  • 245
  • 3
  • 14