public synchronized void stopPeriodicReplication ( ) { if ( isPeriodicReplicationEnabled ( ) ) { setPeriodicReplicationEnabled ( false ) ; AlarmManager alarmManager = ( AlarmManager ) getSystemService ( Context . ALARM_SERVICE ) ; Intent alarmIntent = new Intent ( this , clazz ) ; alarmIntent . setAction ( PeriodicReplicationReceiver . ALARM_ACTION ) ; PendingIntent pendingAlarmIntent = PendingIntent . getBroadcast ( this , 0 , alarmIntent , 0 ) ; alarmManager . cancel ( pendingAlarmIntent ) ; stopReplications ( ) ; } else { Log . i ( TAG , "Attempted to stop an already stopped alarm manager" ) ; } }
Stop replications currently in progress and cancel future scheduled replications .