Android Experts,

I am trying to write a simple receiver that will receive the
BOOT_COMPLETED broadcast, and in turn register a location change
listener. I know the receiver is transient, and has a short lifespan.
Once the receiver dies, will my listener still continue to be
registered, or do I have to write a (perpetual) service to register
the listener?

My code snippet for the receiver is

-------------------------------------------
public class LocationReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
                Log.d("PreciseLocator", "===In Receiver, starting listener");
                LocationManager lm =
(LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
                lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L,
500.0f, new DroidLocationListener());

        }
......

-------------------------------------------

And my manifest looks like follows. Can I have just a receiver,
without an activity in the manifest?

-------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.preciseinc.PreciseLocator"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <receiver android:name=".LocationReceiver"
android:enabled="true">
                <intent-filter>
                        <action
android:name="android.intent.action.BOOT_COMPLETED"></action>
                        <category 
android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
        </receiver>

    </application>
    <uses-sdk android:minSdkVersion="7" />
        <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
permission>
        <uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-
permission>
</manifest>
-------------------------------------------

Any and all help appreciated.

Regards,

Raj.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to