26 lines
983 B
Java
26 lines
983 B
Java
|
package com.itrycn.tellmenotice;
|
||
|
|
||
|
import android.content.BroadcastReceiver;
|
||
|
import android.content.Context;
|
||
|
import android.content.Intent;
|
||
|
import android.media.AudioManager;
|
||
|
import android.widget.Toast;
|
||
|
|
||
|
import java.util.Calendar;
|
||
|
|
||
|
public class BootBroadcastReceiver extends BroadcastReceiver {
|
||
|
@Override
|
||
|
public void onReceive(Context context, Intent intent){
|
||
|
if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) || intent.getAction().equals("android.intent.action.QUICKBOOT_POWERON")){ //开机广播
|
||
|
Toast.makeText(context, "服务启动成功", Toast.LENGTH_SHORT).show();
|
||
|
//Intent intent3 = new Intent(context,MainActivity.class);
|
||
|
//intent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||
|
//context.startActivity(intent3);
|
||
|
Intent intent2 = new Intent(context,NoticeService.class);
|
||
|
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||
|
context.startService(intent2);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|