Blame view

partieAndroid/codesJava/AutoStart.java 778 Bytes
b8e00f52   martin.rohmer   mise à dispositio...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  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();

          }

      }

  }