Switch between WORKOUT_INTENSITY_REST and WORKOUT_INTENSITY_ACTIVE from an app. How can I do that?

I want to create my own interval timer that switches between active and rest states, so the active time is displayed properly in GC. 

All I find is getCurrentWorkoutStep() and getWorkouts(), but how do I create a workout for a custom app?