AutoStart.java
778 Bytes
package com.example.martin.projetv5;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
* Created by martin on 06/05/2017.
*/
public class AutoStart extends BroadcastReceiver
{
Alarm alarm = new Alarm();
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED))
{
StringBDD eventBDD = new StringBDD(context);
eventBDD.open();
for(int i = 0; i<eventBDD.getIndiceMaxPrise(); i++){
Prise2 p = eventBDD.getPriseWithId(i+1);
alarm.setAlarm(context,p.getHeure());
}
eventBDD.close();
}
}
}