You should remove android:permission="android.permission.RECEIVE_BOOT_COMPLETE" from your receiver tag:
-you have a typo in it. -what that really means is "I want the sender to hold that permission", which isn't what you meant, and is probably what prevents your code from working. JBQ On Fri, Feb 27, 2009 at 8:33 AM, Graeme <[email protected]> wrote: > > H'mmm > > I tried adding the following to my AndroidManifest.xml > > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.bt.btinnovate.android.photoobserver" > android:versionCode="1" > android:versionName="1.0.0"> > > <uses-permission > android:name="android.permission.RECEIVE_BOOT_COMPLETED"> > > <application android:icon="@drawable/icon" android:label="@string/ > app_name"> > <receiver android:enabled="true" > android:name=".MyReceiver" > > android:permission="android.permission.RECEIVE_BOOT_COMPLETE" >> > <intent-filter> > <action > android:name="android.intent.action.BOOT_COMPLETE"/> > <category > android:name="android.intent.category.DEFAULT" /> > </intent-filter> > </receiver> > > SNIP... > > My BroadcastReceiver class looks like :- > > > package com.bt.btinnovate.android.photoobserver; > > import java.util.Iterator; > import java.util.Set; > > import android.content.BroadcastReceiver; > import android.content.Context; > import android.content.Intent; > import android.util.Log; > > > public class MyReceiver extends BroadcastReceiver { > private static final String TAG="MyRcvr"; > > @Override > public void onReceive(Context ctxt, Intent intent) { > Log.d(TAG,"onReceive() ---ENTER---"); > Log.d(TAG,"Intent ACTION: "+intent.getAction()); > Log.d(TAG,"Intent CATEGORIES ..."); > Set<String> catSet=intent.getCategories(); > Iterator<String> it=catSet.iterator(); > while (it.hasNext()) { > Log.d(TAG," "+it.next()); > } > Log.d(TAG,"Done."); > Log.d(TAG,"onReceive() ---EXIT-----"); > } > > } > > > When I boot my ADP1 (attached via USB cable to my Windows dev host), I > do not get any indication in ddms that the MyReceiver object is > actually > receiving the BOOT_COMPLETE Intent. Is there anything wrong with my > AndroidManifest.xml entry ? > > Thanks > Graeme > > On Feb 27, 3:47 pm, Jean-Baptiste Queru <[email protected]> wrote: >> You need to do it in your manifest, since at the point where >> boot_completed is sent none of your app code can possibly have run to >> register a listener. >> >> Be aware that boot_completed is a point where the system is under >> heavy load/contention - be sure to keep your onReceive function as >> short as it can possibly be (specifically, avoid I/O if at all >> possible). >> >> JBQ >> >> >> >> >> >> On Fri, Feb 27, 2009 at 7:40 AM, Graeme <[email protected]> wrote: >> >> > Hi >> >> > I have written a Service component within an application .apk. >> > I want the Service to receive the ACTION_BOOT_COMPLETE >> > Intent which I understand is broadcast when the android system has >> > finished booting. >> >> > I am unclear as to whether I need to declare the BroadcastReceiver >> > statically within the AndroidManifest.xml file for the application >> > package >> > via a <receiver> tag or whether I need to create it dynamically and >> > call Context.registerReceiver() etc. within my Service code. >> >> > Can anyone offer any advice, please? >> >> > Thanks >> > Graeme >> >> -- >> Jean-Baptiste M. "JBQ" Queru >> Android Engineer, Google. >> >> Please don't contact me directly.- Hide quoted text - >> >> - Show quoted text - > > > -- Jean-Baptiste M. "JBQ" Queru Android Engineer, Google. Please don't contact me directly. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

