Android 开机启动程序

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class StartupReceiver extends BroadcastReceiver
{
 @Override
 public void onReceive(Context context, Intent intent)
 {
  if(intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ))
  {
   Intent mainIntent = new Intent(context, main.class);
   mainIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
   context.startActivity(mainIntent);
  }
 }
} 
<receiver android:name=".StartupReceiver">  
    <intent-filter>  
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>  
</receiver>   

 

上一篇:python – 使用lxml,导致“lxml.etree.XMLSyntaxError:Document is empty”错误的原因是什么?


下一篇:从0到1学习安卓逆向 | 02编写一个简简单单的注册程序