updated to receive state and duration on gcm method