简体   繁体   中英

How to perform swipe down programmatically in android

Hi I want to refresh a application by swiping down programmatically (for example Facebook app) from a service running in the background. Is it possible?

Not generally. Apps can't send touch events to one another. It can be done if its your app in the foreground receiving the gesture (although then there's easier ways to do this than faking a gesture), or it can maybe be done if you're an accessibility service (but they won't allow you on Google Play if you're using accessibility for something like this).

If its a personal app, you can checkout AccessibilityService and dispatchGesture() for a possible solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM