public static void scheduleLinear(Context context,int delay){
  Intent intent=new Intent(context,HeartbeatReceiver.class);
  intent.putExtra(KEY_DELAY,delay);
  intent.putExtra(KEY_TYPE,TYPE_LINEAR);
  long timeGap=delay * 60 * 1000;
  PendingIntent alarmIntent=PendingIntent.getBroadcast(context,delay,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager alarmManager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() + timeGap,timeGap,alarmIntent);
  Log.d("Heartbeater","Scheduled repeating");
}

public static void scheduleLinear ( Context context , int delay ) { Intent intent = new Intent ( context , HeartbeatReceiver . class ) ; intent . putExtra ( KEY_DELAY , delay ) ; intent . putExtra ( KEY_TYPE , TYPE_LINEAR ) ; long timeGap = delay * 60 * 1000 ; PendingIntent alarmIntent = PendingIntent . getBroadcast ( context , delay , intent , PendingIntent . FLAG_CANCEL_CURRENT ) ; AlarmManager alarmManager = ( AlarmManager ) context . getSystemService ( Context . ALARM_SERVICE ) ; alarmManager . setRepeating ( AlarmManager . RTC_WAKEUP , System . currentTimeMillis ( ) + timeGap , timeGap , alarmIntent ) ; Log . d ( "Heartbeater" , "Scheduled repeating" ) ; }
starts a linear repeated alarm that sends a broadcast to play services , which in turn sends a heartbeat
