标题翻译
How to detect system background touch in android studio programmatically
问题
我正在开发一个屏保应用程序。该应用程序的任务是:在一定时间后,应用程序将在后台运行并将屏幕亮度调暗至0%;当用户从任何地方触摸屏幕时,屏幕亮度将恢复为100%。
该应用程序现在正在后台运行。该应用程序还会在一定时间后将屏幕亮度调暗至0%。我通过使用服务来执行这些任务。但是我无法在我的应用程序中检测到后台屏幕触摸,以将屏幕亮度恢复为100%。
英文翻译
I am building a Screensaver app. The task of this app is: The app will run in the background and dims the screen to 0% after a certain period and when user touch from anywhere the screen brightness will back to 100%.
The app is now running in the background. This app dims the screen brightness to 0% after a certain period also. I do these tasks by using Service. But I can't detect the background screen touch in my app to dim the screen brightness back to 100%.
答案1
得分: 0
你必须将你的类扩展为OnGestureListener、OnDoubleTapListener。从developer.android.com学习OnGestureListener、OnDoubleTapListener。希望这能帮助你。
英文翻译
You have to extend your class with OnGestureListener, OnDoubleTapListener. Study OnGestureListener, OnDoubleTapListener from developer.android.com. Wish this will help you.
专注分享java语言的经验与见解,让所有开发者获益!
评论