Then sorry, but you are doing it wrong.
Consider posting the capx for your project. Without your code and the exact configuration for your project, there's nothing more we can help you with.
Again, make sure the action is triggered by a user action, this is critical for certain devices.