Fixes issue #998.

Fixes multiple issues with the way PR #997 was implemented. 
@TShapinsky I'm changing the key value because some devices might already have the default 'off' value stored in the shared preferences.