Here's a basic example of what I think you're trying to do. You'll need to do a few things. First, grant your application permission to listen for a "Boot completed" signal. In your AndroidManifest.xml, add this line in the manifest section:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Under your application section, add and specify a broadcast receiver for this intent:
<receiver android:name=".MyBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
You also need a broadcast receiver which will respond to this intent and start your service at boot. Create MyBroadcastReceiver.java in your project:
package com.mypackage.myapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context aContext, Intent aIntent) {
// This is where you start your service
aContext.startService(new Intent(aContext, MyService.class));
}
}