You are not referencing the proper this. The if check is in a callback and when it's called there's not CameraController context anymore. you can declare var self = this at the top and check for self.activity.active in the callback.