定时启动Service

利用AlarmManager启动Service.

  AlarmManager alarmManager = (AlarmManager)getContext().getSystemService(Context.ALARM_SERVICE);
            long initialDelay = System.currentTimeMillis() + 1 * 10 * 1000;
            Utils.log("initialDelay="+initialDelay);
            Intent i = new Intent();
            i.setAction(Intent.ACTION_SYNC);
            i.setClassName(getContext(), TwitterService.class.getName());
            PendingIntent intent = PendingIntent.getService(getContext(), 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
            alarmManager.setInexactRepeating(AlarmManager.RTC, initialDelay, AlarmManager.INTERVAL_FIFTEEN_MINUTES, intent);