How to automate android device functions?

Hei everybody!

I am using Appium+Android+Robot Framework. I want to automate, for example going to app manager and clear cash off app. How can I reach device application manager?

Are you specifically testing the user flow to clear an application’s private data, or do you just need to clear the application data for your tests? If the latter, why not use the resetApp functionality (the link leads to Javadocs, but there are equivalents for the other language libraries)?

If you’re actually testing a real user flow to clear the application’s private data, you might want to figure out the activity used for the settings, and then navigate your way to the application manager. You might benefit greatly from the startActivity functionality in this case.

Actually its not important the flow. I tried to set activity to com.android.settings.Settings but its not working. I am using robotframework where i need to put that reset function?

We solved this problem by writing our own adb module (there are just too many things we can’t do easily in Appium without adb). One method we have is for starting other apps. I’m not thrilled that we’ve had to do this, but it’s much easier than the previous solution, which required us to navigate through the different screens to get to Settings, then navigating through settings, which is different on many devices.

The adb command to start AppInfo for a specific application is

adb shell am start -n com.android.settings/.applications.InstalledAppDetails package:#{app_name}

Replace #{app_name} with your app package name

1 Like

I put this command in command line. And what is next? Cause I am running my test in Robot framework. Now I can run the test and it will navigate to settings?

I’m not familiar with the robot framework. When you execute this command, it will start the app info settings screen for your app. If you call this from your framework, you will have to handle the operations on that screen in your framework in order to clear the cache.