add require for service state in examples
Merge pull request #4769 from hvnsweeting/tut2

add require for service state in examples