How can we interact with an Android service that doesn't have a launchable activity?

Our users need a password at a lockscreen, but the screen itself is a service (that is, not an application with a launchable activity). How shall we deal with such?

I don’t understand. Could you post a screencast of how your app is used?

How about two screenshots? When user selects a price profile (Free, Standard, or Premium), the keypad opens, but I can’t script com.telmate.keyguard:id/keyguard_host_view, because it’s a Service, not an Activity (with a corresponding launchable activity for the AppActivity capability).

If you run uiautomatorviewer and take a Device Screenshot, do the elements show up?

Yes, a uiautomatorviewer screenshot shows the screen objects.

Appium should be able to find and interact with the elements then.

Then what should be listed as the AppActivity capability while starting Appium?

You can use this adb command to find the current activity.

It sounds like there’s some way for the user to start the app so it’s just a matter of finding out what that is.

Also have you tried just leaving out the app package and app activity? Appium will try and guess the correct values.

That did the trick!

The ActivityRecord that follows mFocusedApp works as appActivity.

I feel compelled to put this tip in the doc.

Awesome. I agree it should be documented somewhere. I’ve opened an enhancement ticket on GitHub.

Hi Appiumers,

I don’t know if my case is unique, but it is an application with a login page.
The login page is not launch-able. The launch-able activity is the home page after the login page.

So what happens is that launch-able is homePageActivity, but if the user is not authenticated, the user is redirected to loginActivity.

This causes the appium to keep failing with the “activity never started”.
Any tips?

Thanks,
Shiran

What does the adb command I linked output when you’re on the login activity?

Found a solution!
We added several activities to the following parameter: appWaitActivity and it works.

Thanks