Search code examples
androidrobotium

Change android settings programmatically


Can I click on NFC on/off button using robotium? I know NFC cannot be turned on/off programmatically unless the device is rooted. But if I raise a popup for the user to do so and then click on the on/off button.

Just wanted to know is it possible?


Solution

  • If I understand you correctly, you want to take the user to the NFC section of the Device Settings (via a Toast or something similar). If this is correct, then using Robotium you will be able to trigger and action the Toast, but once you are in the device settings, Robotium cannot make the actual selection.

    Android Instrumentation actions are confined to a single package (the one under test).

    Take a look at UIAutomater, this may help.