如何在Android Studio中以编程方式检测系统后台触摸

huangapple 未分类评论67阅读模式
标题翻译

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.

huangapple
  • 本文由 发表于 2020年3月16日 15:06:47
  • 转载请务必保留本文链接:https://java.coder-hub.com/60701622.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定