Folks,

    I have a very simple service with a service started that receives
the BOOT_COMPLETED intent. When I try to launch the debugger, it never
breaks on any line, even though I have waitForDebugger() set. Any
ideas on how I could debug this service. I am debugging this on an
emulator, not on the device.

The manifest file is
--------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.preciseinc.DroidLocator"
      android:versionCode="1"
      android:versionName="1.0">
        <uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/
app_name" android:debuggable="true">
        <service android:name=".DroidService">
                <intent-filter>
                        <action 
android:name="com.preciseinc.DroidLocator.DroidService" />
                </intent-filter>
        </service>
        <receiver android:name=".ServiceAutoStarter">
                <intent-filter>
                <action
android:name="android.intent.action.BOOT_COMPLETED"/>
                </intent-filter>
        </receiver>
        </application>
</manifest>
--------------------------------------------------------

The simple code is
---------------------------------------------------------
package com.preciseinc.DroidLocator;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class ServiceAutoStarter extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
                android.os.Debug.waitForDebugger();
                Intent serviceIntent = new Intent();
                serviceIntent.setComponent(new
ComponentName("com.preciseinc.DroidLocator",
                                "com.preciseinc.DroidLocator.DroidService"));
                context.startService(serviceIntent);
        }

}
----------------------------------------------------------------------

This starts up the service code, which is as follows:

package com.preciseinc.DroidLocator;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.os.IBinder;

public class DroidService extends Service {

        @Override
        public IBinder onBind(Intent arg0) {
                // TODO Auto-generated method stub
                return null;
        }

        @Override
        public void onCreate() {
                android.os.Debug.waitForDebugger();
                super.onCreate();
                LocationManager lm =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
                lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L,
500.0f, new DroidLocationListener());
        }

         @Override
         public void onStart(final Intent intent, final int startId) {
                 android.os.Debug.waitForDebugger();
          super.onStart(intent, startId);
          LocationManager lm =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
          lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L,
500.0f, new DroidLocationListener());
         }


        @Override
        public void onDestroy() {
                super.onDestroy();
        }
}
-------------------------------------------------------------------

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