首先必须有一个BroadcastReceiver以便监听手机 开机intent,
而该receiver又负责启动你的service或者activity. 

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED )){
Intent in = new Intent(context, Vnify.class);   //这是你的activity
in.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK ); 
context.startActivity(in);
}
}
}


其次,就需要在Manifest文件中声明一下intent-filter:
先加入使用权限声明:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
然后加入receiver 注册声明:
<receiver android:name=".BootReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>


这样开机后BootReceiver 就能收到开机的intent,然后自动启动你的activity.